标签:
--创建一个名字为banji0425的数据库 create database banji0425 go --应用banji0425数据库 use banji0425 go --创建一个名字为tongxue的表格 create table tongxue ( code int, name char(20), sex char(20), nianling int, fenshu decimal(18,2), dizhi char(20), ) go --插入表格内容 insert into tongxue values(1,‘刘影‘,‘男‘,28,88,‘桓台‘) go insert into tongxue values(2,‘张德民‘,‘男‘,22,88,‘沂源‘) insert into tongxue values(3,‘马志杰‘,‘男‘,24,85,‘临淄‘) insert into tongxue values(4,‘马庆鑫‘,‘男‘,22,86,‘张店‘) insert into tongxue values(5,‘任东韬‘,‘男‘,25,82,‘沂源‘) insert into tongxue values(6,‘高和平‘,‘男‘,25,85,‘张店‘) insert into tongxue values(7,‘张玉阁‘,‘男‘,24,83,‘沂源‘) insert into tongxue values(8,‘齐鑫‘,‘男‘,25,82,‘周村‘) insert into tongxue values(9,‘刘泓瑞‘,‘男‘,25,85,‘张店‘) go --查询表格所有内容 select *from tongxue go --查询name列 select name from tongxue go --查询name与nianling两列的内容 select name,nianling from tongxue go --查询行为code3的所有内容 select *from tongxue where code=3 go --查询fenshu为85的name select name from tongxue where fenshu=85 go --修改code=3 fenshu为95 update tongxue set fenshu=95 where code=3 go select *from tongxue where code=3 go --查询分数为95并且年龄在24岁的人的名字 select name from tongxue where fenshu=95 and nianling=24 go
标签:
原文地址:http://www.cnblogs.com/fengsantianya/p/5568112.html