数据库的增、删、改、查 、增加列、删除列

varchar(n)   n为数字,表示n位数的字符。

增:

create datebase xuesheng  --建立一个xuesheng的数据库,注意要有go
go
create table xueshengxinxi
(
 code int, --编号为int
name varchar(20), --名字为varchar
score decimal(10,2)  --一个10位数的字,其中小数点为2位
)
insert into xueshengxinxi values(1,'小红',4.34)
insert into xueshengxinxi values(2,'小刚',2.67)

 删:

delete from xueshengxinxi where name='小红'   --删除xueshengxinxi这个表格中小红的全部信息

改:

update xueshengxinxi set name='小刚' where name='小狗'   --把xueshengxinxi的表格中的小刚改为小狗

查:

select name,score from xueshengxinxi where name='小红' --在xueshengxinxi这个表格中查询小红的name和score

增加列:

alter table Ha add [id] int 
//Ha:表名  [id]列名  int:数据类型

删除列

alter table Ha drop column id
// Ha:表名  id:列名

完!

原文地址:https://www.cnblogs.com/wwz-wwz/p/5818704.html