av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

學(xué)習(xí)DB2數(shù)據(jù)庫時(shí),你要掌握的語句有哪些?

此文章主要向大家講述的是學(xué)習(xí)DB2數(shù)據(jù)庫時(shí),我們大家所必須掌握的10條常用語句,以下就是文章對學(xué)習(xí)DB2數(shù)據(jù)庫時(shí),我們大家所必須掌握的10條常用語句的詳細(xì)描述,望大家在瀏覽之后會(huì)對其有更深的了解。

網(wǎng)站建設(shè)哪家好,找成都創(chuàng)新互聯(lián)公司!專注于網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、小程序設(shè)計(jì)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了滴道免費(fèi)建站歡迎大家使用!

數(shù)據(jù)庫, 語句, 學(xué)習(xí)數(shù)據(jù)庫, 語句, 學(xué)習(xí)

1、查找員工的編號、姓名、部門和出生日期,如果出生日期為空值,顯示日期不詳,并按部門排序輸出,日期格式為yyyy-mm-dd

 
 
 
  1. select emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),'日期不詳') birthday   
  2. from employee   
  3. order by dept  

2、查找與喻自強(qiáng)在同一個(gè)單位的員工姓名、性別、部門和職稱

 
 
 
  1. select emp_no,emp_name,dept,title   
  2. from employee   
  3. where emp_name<>'喻自強(qiáng)' and dept in   
  4. (select dept from employee   
  5. where emp_name='喻自強(qiáng)')  

3、按部門進(jìn)行匯總,統(tǒng)計(jì)每個(gè)部門的總工資

 
 
 
  1. select dept,sum(salary)   
  2. from employee   
  3. group by dept  

學(xué)習(xí)DB2數(shù)據(jù)庫必須掌握的語句4、查找商品名稱為14寸顯示器商品的銷售情況,顯示該商品的編號、銷售數(shù)量、單價(jià)和金額

 
 
 
  1. select a.prod_id,qty,unit_price,unit_price*qty totprice   
  2. from sale_item a,product b   
  3. where a.prod_id=b.prod_id and prod_name='14寸顯示器'  

5、在銷售明細(xì)表中按產(chǎn)品編號進(jìn)行匯總,統(tǒng)計(jì)每種產(chǎn)品的銷售數(shù)量和金額

 
 
 
  1. select prod_id,sum(qty) totqty,sum(qty*unit_price) totprice   
  2. from sale_item   
  3. group by prod_id  

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

 
 
 
  1. select cust_id,sum(tot_amt) totprice   
  2. from sales   
  3. where convert(char(4),order_date,120)='1996'   
  4. group by cust_id  

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

 
 
 
  1. select a.cust_id,cust_name,sum(tot_amt) totprice   
  2. from customer a,sales b   
  3. where a.cust_id=b.cust_id   
  4. group by a.cust_id,cust_name  

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

 
 
 
  1. select a.cust_id,cust_name,sum(tot_amt) totprice   
  2. from customer a,sales b   
  3. where a.cust_id=b.cust_id and convert(char(4),order_date,120)='1997'   
  4. group by a.cust_id,cust_name   

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

 
 
 
  1. select order_no,cust_id,sale_id,tot_amt   
  2. from sales   
  3. where tot_amt=   
  4. (select max(tot_amt)   
  5. from sales)  

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

 
 
 
  1. select emp_name,order_date   
  2. from employee a,sales b   
  3. where emp_no=sale_id and a.emp_no in   
  4. (select sale_id   
  5. from sales   
  6. group by sale_id   
  7. having count(*)>=3)   
  8. order by emp_name   

以上的相關(guān)內(nèi)容就是對學(xué)習(xí)DB2數(shù)據(jù)庫必須掌握的五十四條常用語句的介紹,望你能有所收獲。


分享標(biāo)題:學(xué)習(xí)DB2數(shù)據(jù)庫時(shí),你要掌握的語句有哪些?
文章網(wǎng)址:http://uogjgqi.cn/article/cohigid.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們在微信上24小時(shí)期待你的聲音

解答本文疑問/技術(shù)咨詢/運(yùn)營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流