学习数据库必须掌握的54条SQL查询语句解释.doc

学习数据库必须掌握的54条SQL查询语句解释.doc

学习数据库必须掌握的54条SQL查询语句1 --1、查找员工的编号、姓名、部门和出生日期,如果出生日期为空值,显示日期不详,并按部门排序输出,日期格式为yyyy-mm-dd。 2 select emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),日期不详) birthday 3 from employee 4 order by dept 5 6 --2、查找与喻自强在同一个单位的员工姓名、性别、部门和职称 7 select emp_no,emp_name,dept,title 8 from employee 9 where emp_name喻自强 and dept in 10 (select dept from employee 11 where emp_name=喻自强) 12 13 --3、按部门进行汇总,统计每个部门的总工资 14 select dept,sum(salary) 15 from employee 16 group by dept 17 18 --4、查找商品名称为14寸显示器商品的销售情况,显示该商品的编号、销售数量、单价和金额 19 select a.prod_id,qty,unit_price,unit_price*qty totpr

文档评论(0)

1亿VIP精品文档

相关文档