2016年10月17日

简单查询

摘要: 分组查询 查询汽车表中,每个系列汽车的数量 select brand,count(*) from car group by brand 去该系列价格平均值大于40的系列代号 select brand from car group by brand having avg(price)>40 取该系列油耗最大值大于8的系列代号 select brand from car group ... 阅读全文

posted @ 2016-10-17 16:26 奔跑的葛根 阅读(140) 评论(0) 推荐(0)

高级查询

摘要: 连接查询 select *from info,nation 形成笛卡尔积 select info.code,info.name,info.Sex,nation.name,info.birthday from info,nation where info.nation=nation.code select *from info join nation on info.nation=nation.... 阅读全文

posted @ 2016-10-17 15:56 奔跑的葛根 阅读(137) 评论(0) 推荐(0)

SQL语句增加列、修改列类型、修改列、删除列

摘要: 1.增加列: alter table tableName add columnName varchar(30) 2.修改列类型: alter table tableName alter column columnName varchar(4000) 3.修改列的名称: EXEC sp_rename 'tableName.column1' , 'column2' (把表名为t... 阅读全文

posted @ 2016-10-17 08:38 奔跑的葛根 阅读(709) 评论(0) 推荐(0)

导航