51CTO下载-五十四条DB2常用语句集萃.docVIP

  • 1
  • 0
  • 约9.41千字
  • 约 10页
  • 2017-08-05 发布于河南
  • 举报
1、查找员工的编号、姓名、部门和出生日期,如果出生日期为空值,显示日期不详,并按部门排序输出,日期格式为yyyy-mm-dd。select emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),日期不详) birthday from employee order by dept   2、查找与喻自强在同一个单位的员工姓名、性别、部门和职称 select emp_no,emp_name,dept,title from employee where emp_name喻自强 and dept in (select dept from employee where emp_name=喻自强)   3、按部门进行汇总,统计每个部门的总工资 select dept,sum(salary) from employee group by dept   4、查找商品名称为14寸显示器商品的销售情况,显示该商品的编号、销售数量、单价和金额 select a.prod_id,qty,unit_price,unit_price*qty totprice from sale_item a,product b where a.prod_id=b.prod_id and prod_name=14寸显示器   5、在销售明细表中按产品

文档评论(0)

1亿VIP精品文档

相关文档