create database s2015041--创建数据库 drop database XXXXXX--删除数据库 use master--使用master数据库 go--语句与语句的链接符号 create table abb ( code int not null,--列 name varchar(50) not null,--列 sex int, degree decimal(18,2) not null--列 ) go insert into abb values(1,'张三',0,99); insert into abb values(2,'李四',1,79);--主键设置完成后需要保存后才能被识别,防止重复 insert into abb(code,name,degree) values(4,'王五',97);--指定列添加 go select *from abb --查询 update abb set sex=1--修改所有的行中的sex列的值 update abb set sex=1 where code=4--加where条件筛选修改code=3那一行的sex update abb set name='田七',sex=0,code=3,degree=99 where code=4 delete from abb--删除所有数据 delete from abb where code=1 create table abc--修改表内信息需要重新执行一下表 ( no int primary key identity(1,1), name varchar(50) not null, sex varchar(50) not null, age int not null, high int not null, [weight] int not null, id int not null, [address] varchar(50)not null ) go insert into abc values('李四','男',18,173,75,37030319,'亚特兰蒂斯') insert into abc values('小二','女',21,163,60,37030319,'远离一切之理想乡') insert into abc values('王五','男',18,183,85,37030317,'阿尔托利亚') insert into abc values('蕾蕾','男',18,189,68,37039011,'圣安地列斯') insert into abc values('小黄','女',16,155,48,37099006,'楼兰古国') insert into abc values('小花','女',24,161,50,37099307,'亚历山大') select *from abc delete from abc update abc set name='张三' where name='李四';