亚洲AV无码乱码在线观看不卡|最新大伊香蕉精品视频在线|亚洲不卡av一区二区|国产美女无遮挡免费

登錄論壇 | 注冊(cè)會(huì)員 設(shè)為首頁(yè) | 收藏本站
當(dāng)前位置 : 首頁(yè)>軟件學(xué)院>數(shù)據(jù)庫(kù)>SQL>正文
 
學(xué)習(xí)DB2數(shù)據(jù)庫(kù)必須掌握的五十四條常用語(yǔ)句

http://m.yibo1263.com 2008/5/12 8:19:06  來(lái)源:ccident  編輯:張佳奇
 

26、選取編號(hào)界于'C0001'和'C0004'的客戶編號(hào)、客戶名稱、客戶地址

select CUST_ID,cust_name,addr

from customer

where cust_id between 'C0001' AND 'C0004'

27、計(jì)算出一共銷售了幾種產(chǎn)品

select count(distinct prod_id) as '共銷售產(chǎn)品數(shù)'

from sale_item

28、將業(yè)務(wù)部員工的薪水上調(diào)3%

update employee

set salary=salary*1.03

where dept='業(yè)務(wù)'

29、由employee表中查找出薪水最低的員工信息

select *

from employee

where salary=

(select min(salary )

from employee )

30、使用join查詢客戶姓名為"客戶丙"所購(gòu)貨物的"客戶名稱","定單金額","定貨日期","電話號(hào)碼"

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業(yè)務(wù)員在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、計(jì)算'P0001'產(chǎn)品的平均銷售單價(jià)

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、找出同一天進(jìn)入公司服務(wù)的員工

select a.emp_no,a.emp_name,a.date_hired

from employee a

join employee b

on (a.emp_no!=b.emp_no and a.date_hired=b.date_hired)

order by a.date_hired

35、找出目前業(yè)績(jī)超過(guò)232000元的員工編號(hào)和姓名

select emp_no,emp_name

from employee

where emp_no in

(select sale_id

from sales

group by sale_id

having sum(tot_amt)<232000)

36、查詢出employee表中所有女職工的平均工資和住址在"上海市"的所有女職工的平均工資

select avg(salary)

from employee

where sex like 'f'

union

select avg(salary)

from employee

where sex like 'f' and addr like '上海市%'

37、在employee表中查詢薪水超過(guò)員工平均薪水的員工信息

Select *

from employee

where salary>( select avg(salary)

from employee)

38、 找出目前銷售業(yè)績(jī)超過(guò)10000元的業(yè)務(wù)員編號(hào)及銷售業(yè)績(jī),并按銷售業(yè)績(jī)從大到小排序

Select sale_id ,sum(tot_amt)

from sales

group by sale_id

having sum(tot_amt)>10000

order by sum(tot_amt) desc

39、 找出公司男業(yè)務(wù)員所接且訂單金額超過(guò)2000元的訂單號(hào)及訂單金額

Select order_no,tot_amt

From sales ,employee

Where sale_id=emp_no and sex='M' and tot_amt>2000

40、 查詢sales表中訂單金額最高的訂單號(hào)及訂單金額

Select order_no,tot_amt from sales

where tot_amt=(select max(tot_amt) from sales)

41、 查詢?cè)诿繌堄唵沃杏嗁?gòu)金額超過(guò)4000元的客戶名及其地址

Select cust_name,addr from customer a,sales b

where a.cust_id=b.cust_id and tot_amt>4000

42、 求出每位客戶的總訂購(gòu)金額,顯示出客戶號(hào)及總訂購(gòu)金額,并按總訂購(gòu)金額降序排列

Select cust_id,sum(tot_amt) from sales

Group by cust_id

Order by sum(tot_amt) desc

43、 求每位客戶訂購(gòu)的每種產(chǎn)品的總數(shù)量及平均單價(jià),并按客戶號(hào),產(chǎn)品號(hào)從小到大排列

Select cust_id,prod_id,sum(qty),sum(qty*unit_price)/sum(qty)

From sales a, sale_item b

Where a.order_no=b.order_no

本新聞共4頁(yè),當(dāng)前在第3頁(yè)  1  2  3  4  

收藏】【打印】【進(jìn)入論壇
  相關(guān)文章:

·金倉(cāng)護(hù)航電力應(yīng)用數(shù)據(jù)表超越國(guó)外數(shù)據(jù)庫(kù)
·IBM收購(gòu)數(shù)據(jù)庫(kù)安全公司Guardium
·IBM或斥資2.25億美元收購(gòu)數(shù)據(jù)庫(kù)安全軟件廠商
·解決數(shù)據(jù)庫(kù)開(kāi)發(fā)中的疑難問(wèn)題
·快速了解服務(wù)器數(shù)據(jù)庫(kù)系統(tǒng)的優(yōu)點(diǎn) 
·教你為數(shù)據(jù)庫(kù)服務(wù)器配置存儲(chǔ)和內(nèi)存
·數(shù)據(jù)庫(kù)服務(wù)器安全的權(quán)限控制策略
·長(zhǎng)期使用中型Access數(shù)據(jù)庫(kù)的一點(diǎn)經(jīng)驗(yàn)
·教你簡(jiǎn)便實(shí)現(xiàn)Oracle數(shù)據(jù)庫(kù)文件移動(dòng)方法
·網(wǎng)站整體優(yōu)化之?dāng)?shù)據(jù)庫(kù)優(yōu)化
·Dreamweaver中數(shù)據(jù)庫(kù)路徑的使用

 
 
 
最新文章

搶先蘋果,消息稱英特爾芯片采用臺(tái)積電
三星揭曉業(yè)內(nèi)首款單條 512GB DDR5 內(nèi)存
vivo 高端新機(jī)爆料:120Hz 曲面屏 + 天
vivo Y21 在印度正式上市:Helio P35 芯
微星推出 GeForce RTX 3080 Sea Hawk X
消息稱三星 Galaxy Tab S8 系列平板將放
機(jī)械革命推出 F6 輕薄本:16 英寸全面屏
英特爾 12 代 Alder Lake CPU 600 系列
雷軍:向小米手機(jī) 1 首批用戶每人贈(zèng)送價(jià)
小米李明談?dòng)脩舯惶叱?nbsp;MIUI 測(cè)試版:大

推薦文章
1
2
3
4
5
6
7
8
9
10
叛逆嫩模性感寫(xiě)真
宮如敏不雅照瘋傳 看張馨予韓一菲獸獸誰(shuí)
不懼孔子搶位 阿凡達(dá)游戲影音配置推薦
2015第十七屆“東北安博會(huì)”火爆招商
第十六屆東北國(guó)際公共安全防范產(chǎn)品博覽
2016年第五屆中國(guó)國(guó)際商業(yè)信息化博覽會(huì)
2016年第五屆中國(guó)國(guó)際POS機(jī)及相關(guān)設(shè)備展
互聯(lián)網(wǎng)電視熟了嗎 2013最火電視深解析
桑達(dá)獲邀出席2015中國(guó)(廣州)國(guó)際POS機(jī)
寶獲利報(bào)名參加“2015年度中國(guó)POS機(jī)行業(yè)
八卦圖解 More>>
叛逆嫩模性感寫(xiě)真 宮如敏不雅照瘋傳 看張馨予韓一菲
周偉童魔鬼身材日本性感寫(xiě)真圖  聯(lián)想V360筆記本模特寫(xiě)真