日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
DB2數(shù)據(jù)庫必須掌握的常用語句(一)

DB2數(shù)據(jù)庫常用的語句:

成都創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站設(shè)計、做網(wǎng)站與策劃設(shè)計,陽春網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)10余年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:陽春等地區(qū)。陽春做網(wǎng)站價格咨詢:18982081108

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、按部門進行匯總,統(tǒng)計每個部門的總工資

select dept,sum(salary)

from employee

group by dept

4、查找商品名稱為14寸顯示器商品的銷售情況,顯示該商品的編號、銷售數(shù)量、單價和金額

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、在銷售明細表中按產(chǎn)品編號進行匯總,統(tǒng)計每種產(chǎn)品的銷售數(shù)量和金額

select prod_id,sum(qty) totqty,sum(qty*unit_price) totprice

from sale_item

group by prod_id

6、使用convert函數(shù)按客戶編號統(tǒng)計每個客戶1996年的訂單總金額

select cust_id,sum(tot_amt) totprice

from sales

where convert(char(4),order_date,120)='1996'

group by cust_id

7、查找有銷售記錄的客戶編號、名稱和訂單總額

select a.cust_id,cust_name,sum(tot_amt) totprice

from customer a,sales b

where a.cust_id=b.cust_id

group by a.cust_id,cust_name

8、查找在1997年中有銷售記錄的客戶編號、名稱和訂單總額

select a.cust_id,cust_name,sum(tot_amt) totprice

from customer a,sales b

where a.cust_id=b.cust_id and convert(char(4),order_date,120)='1997'

group by a.cust_id,cust_name

9、查找一次銷售***的銷售記錄

select order_no,cust_id,sale_id,tot_amt

from sales

where tot_amt=

(select max(tot_amt)

from sales)

10、查找至少有3次銷售的業(yè)務(wù)員名單和銷售日期

select emp_name,order_date

from employee a,sales b

where emp_no=sale_id and a.emp_no in

(select sale_id

from sales

group by sale_id

having count(*)>=3)

order by emp_name

這就是我要為大家介紹的DB2數(shù)據(jù)庫必須掌握的常用語句十則,另外還有很多常用語句這里還沒有介紹到,在以后的文章中會為大家介紹更多的知識,希望大家繼續(xù)關(guān)注。


網(wǎng)站標題:DB2數(shù)據(jù)庫必須掌握的常用語句(一)
轉(zhuǎn)載源于:http://m.5511xx.com/article/copdhpp.html