学习DB2数据库必须掌握的五十四条常用语句
2009-05-18 16:15:11 来源:WEB开发网from customer
where cust_id between 'C0001' AND 'C0004'
27、计算出一共销售了几种产品
select count(distinct prod_id) as '共销售产品数'
from sale_item
28、将业务部员工的薪水上调3%
update employee
set salary=salary*1.03
where dept='业务'
29、由employee表中查找出薪水最低的员工信息
select *
from employee
where salary=
(select min(salary )
from employee )
30、使用join查询客户姓名为"客户丙"所购货物的"客户名称","定单金额","定货日期","电话号码"
select a.cust_id,b.tot_amt,b.order_date,a.tel_no
from customer a join sales b
on a.cust_id=b.cust_id and cust_name like '客户丙'
31、由sales表中查找出订单金额大于"E0013业务员在1996/10/15这天所接每一张订单的金额"的所有订单
select *
from sales
where tot_amt>all
(select tot_amt
from sales
where sale_id='E0013'and order_date='1996/10/15')
order by tot_amt
32、计算'P0001'产品的平均销售单价
select avg(unit_price)
from sale_item
where prod_id='P0001'
33、找出公司女员工所接的定单
select sale_id,tot_amt
from sales
where sale_id in
(select sale_id from employee
where sex='F')
34、找出同一天进入公司服务的员工
更多精彩
赞助商链接