码迷,mamicode.com
首页 > 数据库 > 详细

数据库的增、删、改、查

时间:2016-08-29 17:37:37      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

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

  

数据库的增、删、改、查

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!