自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

DB2數(shù)據(jù)庫(kù)必須掌握的常用語(yǔ)句(一)

數(shù)據(jù)庫(kù)
DB2數(shù)據(jù)庫(kù)是IBM出口的一系列關(guān)系型數(shù)據(jù)庫(kù)管理系統(tǒng),分別在不同的操作系統(tǒng)平臺(tái)上服務(wù)。本文將介紹DB2數(shù)據(jù)庫(kù)必須掌握的常用語(yǔ)句。

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

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

select emp_no,emp_name,dept,isnull(convert(char(10),birthday,120),'日期不詳') birthday

from employee

order by dept

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

select emp_no,emp_name,dept,title

from employee

where emp_name<>'喻自強(qiáng)' and dept in

(select dept from employee

where emp_name='喻自強(qiáng)')

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

select dept,sum(salary)

from employee

group by dept

 

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

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

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

from sale_item

group by prod_id

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

select cust_id,sum(tot_amt) totprice

from sales

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

group by cust_id

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

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年中有銷售記錄的客戶編號(hào)、名稱和訂單總額

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ù)庫(kù)必須掌握的常用語(yǔ)句十則,另外還有很多常用語(yǔ)句這里還沒(méi)有介紹到,在以后的文章中會(huì)為大家介紹更多的知識(shí),希望大家繼續(xù)關(guān)注。

【編輯推薦】

  1. 通過(guò)JDBC連接DB2數(shù)據(jù)庫(kù)技巧
  2. 講解IBM DB2數(shù)據(jù)庫(kù)的常用日期操作函數(shù)
  3. DB2數(shù)據(jù)庫(kù)的安裝
責(zé)任編輯:迎迎 來(lái)源: 天極網(wǎng)
相關(guān)推薦

2011-03-16 10:19:49

DB2數(shù)據(jù)庫(kù)常用語(yǔ)句

2011-03-16 10:12:14

DB2數(shù)據(jù)庫(kù)常用語(yǔ)句

2011-03-16 10:39:11

DB2數(shù)據(jù)庫(kù)常用語(yǔ)句

2011-03-16 10:59:34

DB2數(shù)據(jù)庫(kù)常用語(yǔ)句

2010-11-04 12:00:59

db2存儲(chǔ)過(guò)程

2010-08-10 09:07:51

DB2數(shù)據(jù)庫(kù)優(yōu)化

2010-08-09 13:08:45

DB2數(shù)據(jù)庫(kù)

2010-07-29 09:44:35

DB2數(shù)據(jù)庫(kù)優(yōu)化

2010-09-06 10:00:00

DB2數(shù)據(jù)庫(kù)

2010-04-13 15:24:25

Oracle維護(hù)常用語(yǔ)

2010-08-25 15:13:22

DB2Oracle數(shù)據(jù)庫(kù)

2011-03-11 16:02:03

DB2數(shù)據(jù)庫(kù)安裝

2010-07-27 08:48:52

DB2數(shù)據(jù)庫(kù)優(yōu)化

2010-10-08 10:18:26

MySQL自增字段

2011-08-31 16:33:00

DB2

2010-11-03 16:32:10

DB2創(chuàng)建數(shù)據(jù)庫(kù)

2010-06-01 16:02:00

MySQL 常用語(yǔ)句

2011-03-04 17:54:45

DB2數(shù)據(jù)庫(kù)卸載

2010-08-25 10:50:48

DB2數(shù)據(jù)庫(kù)

2010-09-01 13:38:41

DB2數(shù)據(jù)復(fù)制
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)