锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
Martin.guo
聽
J2ee 鏋舵瀯涓竴鑸兘瑕佽冭檻 Web Framework 鐨勯夋嫨銆傚緢澶氫漢閫夋嫨姣旇緝嫻佽鐨?/span> Struts 銆傞」鐩粍涓亣鍒拌繃榪欐牱鐨勬儏鍐碉紝鏈変簺浜轟笉鐔熸倝 Struts 錛岃屾湁浜涗漢鍙堝 Struts 闈掔潗鏈夊姞銆傛湁娌℃湁涓涓姌涓殑鍔炴硶鏉ユ弧瓚蟲墍鏈夌殑浜哄憿錛?/span>
聽
鎴戞槸榪欐牱璁捐鐨勶細
閫氳繃鎷︽埅鎻愪氦鍒?/span> ActionServlet 涓婄殑 http 璇鋒眰錛岀粡榪?/span> Http Parse 鏉ユ敹闆嗚姹傚弬鏁幫紝浠?/span> Name-Value 鐨勫艦寮忓瓨鏀句負璇鋒眰鍊煎璞★紝騫朵笖鏀懼湪璇鋒眰綰跨▼鐩稿叧鐨勪笂涓嬫枃涓傝繖涓椂鍊欎綘灝卞彲浠ュ湪 Action 鎵ц緇撴潫鍓嶇殑浠諱綍鍦版柟鎷垮埌榪欎簺璇鋒眰鏁版嵁浜嗐?/span>
聽
鍦ㄨ繖涓熀紜涓婏紝鎴戜滑淇濈暀浜?/span> Struts 鐨?/span> Action 錛屽茍涓旇瀹?/span> Action 鐨?/span> execute 鏂規硶閲屼笉鑳藉嚭鐜頒換浣曡窡涓氬姟鐩稿叧鐨勪唬鐮?/span> , 浠呬粎鏄礋璐i〉闈㈢殑嫻佽漿銆?/span>
聽
閭d箞涓氬姟鎬庝箞鍔炲憿錛熸垜浠畾涔変簡涓涓帴鍙?/span> Command, 瀹冧篃鍙湁涓涓柟娉?/span> , 鎴戜滑涔熷彇鍚嶅瓧涓?/span> execute, 騫朵笖娌℃湁浠諱綍鍙傛暟鍜岃繑鍥炴暟鍊箋傝鏂規硶鐨勮亴璐e氨鏄墽琛屼笟鍔¢昏緫銆傝繖涓椂鍊欎綘灝辮闂簡銆?/span> Action 閲屾娊紱諱笟鍔¢昏緫錛屾庝箞璋冪敤 Command 鍛紵璇鋒眰鎻愪氦鐨勬暟鎹庝箞緇?/span> Command 鍛?/span> ?Command 鎵ц瀹屽悗鐨勪笟鍔℃暟鎹庝箞榪斿洖錛?/span>
聽
鎴戜滑璁捐浜嗕竴涓笟鍔℃墽琛屽櫒錛屽畠鐨勫姛鑳藉氨鏄墽琛?/span> Command 鐨勪笟鍔¢昏緫瀹炵幇 . 鑰屾妸鎵ц鍣ㄧ殑鎵ц鍐欏埌浜?/span> Action 閲岄潰銆傝繖鏍峰氨闅旂浜嗛〉闈㈡祦杞拰涓氬姟鎵ц銆?/span> Action 鐨勪唬鐮佹樉鐨勫緢綆緇冨拰妯℃澘鍖栥?/span>
聽
鐢變簬璇鋒眰鏁版嵁鏄斁鍦ㄨ姹傜嚎紼嬬浉鍏崇殑涓婁笅鏂囦腑錛屾墍浠ュ彲浠ュ緢鏂逛究鐨勬嬁鍒般傚悓鏃?/span> Command 鎵ц瀹屾瘯鐨勮繑鍥炴暟鎹篃鏄氳繃榪欎釜涓婁笅鏂囪繑鍥炵粰 Action 鎴栬呭叾浠栬窡姝よ姹傜嚎紼嬬浉鍏崇殑緇勪歡錛岃鐧戒竴鐐瑰氨鏄綰跨▼鑳藉璺戝埌鐨勪換浣曚唬鐮佸閮藉彲浠ュ幓璺熶笂涓嬫枃浜や簰錛屽瓨鍙栫嚎紼嬬浉鍏崇殑鏁版嵁鍜屾湇鍔°?/span>
聽
璁捐鍒版涓烘錛屽凡緇忓彲浠ュ洖絳斿紑澶寸殑闂浜嗐?/span>
聽
瀵逛簬鐔熸倝 Struts 鐨勪漢鍛紝鍙互縐瀬鏀懼績鐨勪嬌鐢?/span> Struts 鏍囩錛屼嬌鐢?/span> Formbean, 浣嗘湁涓鐐瑰氨鏄嚜宸辮鎶?/span> FormBean 鏀懼埌綰跨▼鐩稿叧鐨勪笂涓嬫枃涓紝榪欐牱浣犲氨鍙互鍦?/span> Command 閲岄潰鍘繪嬁鍑烘潵宸ヤ綔浜嗭紝鍚屾椂 Command 鎵ц瀹屾瘯鍚庯紝浣犲氨鍙互欏烘墜鎶婅繑鍥炴暟鎹~鍏呭埌榪欎釜 FormBean 閲岄潰鍘諱簡銆傝窡浣犲鉤鏃朵嬌鐢ㄦ病鏈夊お澶у尯鍒?/span>
聽
鑰屽浜庝笉鐔熸倝鐨勪漢鍛紝浣犲彲鑳戒笉鍠滄鍐?/span> Struts 鏍囩錛屼篃鍙兘涓嶅枩嬈㈡鏉跨殑 Formbean, 閭d箞 OK 錛屼綘瀹屽叏涓嶇敤鍏沖績榪欎簺錛屼綘鍙鐩存帴鍦?/span> Command 閲岄潰鍘誨啓閫昏緫浠g爜灝卞彲浠ヤ簡銆備絾鏈変竴鐐瑰氨鏄錛屼綘瑕佹墜宸ユ妸榪斿洖鐨勬暟鎹泦鍚堟斁鍒?/span> request 閲岄潰鍘伙紝鐒跺悗鍒版祦杞殑 JSP 閲岄潰鍙栧嚭鏉ュ睍紺恒?/span>
聽
OK 錛岀殕澶ф鍠溿?/span>
聽
聽
msn:gdq123@hotmail.com
msn:gdq123@hotmail.com
msn:gdq123@hotmail.com
--3銆佹寜閮ㄩ棬榪涜姹囨伙紝緇熻姣忎釜閮ㄩ棬鐨勬誨伐璧?br />select dept,sum(salary)
from employee
group by dept
--4銆佹煡鎵懼晢鍝佸悕縐頒負14瀵告樉紺哄櫒鍟嗗搧鐨勯攢鍞儏鍐碉紝
--鏄劇ず璇ュ晢鍝佺殑緙栧彿銆侀攢鍞暟閲忋佸崟浠峰拰閲戦
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銆佸湪閿鍞槑緇嗚〃涓寜浜у搧緙栧彿榪涜姹囨伙紝緇熻姣忕浜у搧鐨勯攢鍞暟閲忓拰閲戦
select prod_id,sum(qty) totqty,sum(qty*unit_price) totprice
from sale_item
group by prod_id
--6銆佷嬌鐢╟onvert鍑芥暟鎸夊鎴風紪鍙風粺璁℃瘡涓鎴?996騫寸殑璁㈠崟鎬婚噾棰?br />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銆佹煡鎵句竴嬈¢攢鍞渶澶х殑閿鍞褰?br />select order_no,cust_id,sale_id,tot_amt
from sales
where tot_amt=
(select max(tot_amt)
from sales)
--10銆佹煡鎵捐嚦灝戞湁3嬈¢攢鍞殑涓氬姟鍛樺悕鍗曞拰閿鍞棩鏈?br />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
--11銆佺敤瀛樺湪閲忚瘝鏌ユ壘娌℃湁璁㈣揣璁板綍鐨勫鎴峰悕縐?br />select cust_name
from customer a
where not exists
(select *
from sales b
where a.cust_id=b.cust_id)
--12銆佷嬌鐢ㄥ乏澶栬繛鎺ユ煡鎵炬瘡涓鎴風殑瀹㈡埛緙栧彿銆佸悕縐般佽璐ф棩鏈熴佽鍗曢噾棰?br />--璁㈣揣鏃ユ湡涓嶈鏄劇ず鏃墮棿錛屾棩鏈熸牸寮忎負yyyy-mm-dd
--鎸夊鎴風紪鍙鋒帓搴忥紝鍚屼竴瀹㈡埛鍐嶆寜璁㈠崟闄嶅簭鎺掑簭杈撳嚭
select a.cust_id,cust_name,convert(char(10),order_date,120),tot_amt
from customer a left outer join sales b on a.cust_id=b.cust_id
order by a.cust_id,tot_amt desc
--13銆佹煡鎵?6M DRAM鐨勯攢鍞儏鍐碉紝瑕佹眰鏄劇ず鐩稿簲鐨勯攢鍞憳鐨勫鍚嶃?br />--鎬у埆錛岄攢鍞棩鏈熴侀攢鍞暟閲忓拰閲戦錛屽叾涓у埆鐢ㄧ敺銆佸コ琛ㄧず
select emp_name 濮撳悕, 鎬у埆= case a.sex when 'm' then '鐢?
when 'f' then '濂?
else '鏈?
end,
閿鍞棩鏈? isnull(convert(char(10),c.order_date,120),'鏃ユ湡涓嶈'),
qty 鏁伴噺, qty*unit_price as 閲戦
from employee a, sales b, sale_item c,product d
where d.prod_name='16M DRAM' and d.prod_id=c.prod_id and
a.emp_no=b.sale_id and b.order_no=c.order_no
--14銆佹煡鎵炬瘡涓漢鐨勯攢鍞褰曪紝瑕佹眰鏄劇ず閿鍞憳鐨勭紪鍙楓佸鍚嶃佹у埆銆?br />--浜у搧鍚嶇О銆佹暟閲忋佸崟浠楓侀噾棰濆拰閿鍞棩鏈?br />select emp_no 緙栧彿,emp_name 濮撳悕, 鎬у埆= case a.sex when 'm' then '鐢?
when 'f' then '濂?
else '鏈?
end,
prod_name 浜у搧鍚嶇О,閿鍞棩鏈? isnull(convert(char(10),c.order_date,120),'鏃ユ湡涓嶈'),
qty 鏁伴噺, qty*unit_price as 閲戦
from employee a left outer join sales b on a.emp_no=b.sale_id , sale_item c,product d
where d.prod_id=c.prod_id and b.order_no=c.order_no
--15銆佹煡鎵鵑攢鍞噾棰濇渶澶х殑瀹㈡埛鍚嶇О鍜屾昏揣嬈?br />select cust_name,d.cust_sum
from customer a,
(select cust_id,cust_sum
from (select cust_id, sum(tot_amt) as cust_sum
from sales
group by cust_id ) b
where b.cust_sum =
( select max(cust_sum)
from (select cust_id, sum(tot_amt) as cust_sum
from sales
group by cust_id ) c )
) d
where a.cust_id=d.cust_id
--16銆佹煡鎵鵑攢鍞婚灝戜簬1000鍏冪殑閿鍞憳緙栧彿銆佸鍚嶅拰閿鍞
select emp_no,emp_name,d.sale_sum
from employee a,
(select sale_id,sale_sum
from (select sale_id, sum(tot_amt) as sale_sum
from sales
group by sale_id ) b
where b.sale_sum <1000
) d
where a.emp_no=d.sale_id
--17銆佹煡鎵捐嚦灝戦攢鍞簡3縐嶅晢鍝佺殑瀹㈡埛緙栧彿銆佸鎴峰悕縐般佸晢鍝佺紪鍙楓佸晢鍝佸悕縐般佹暟閲忓拰閲戦
select a.cust_id,cust_name,b.prod_id,prod_name,d.qty,d.qty*d.unit_price
from customer a, product b, sales c, sale_item d
where a.cust_id=c.cust_id and d.prod_id=b.prod_id and
c.order_no=d.order_no and a.cust_id in (
select cust_id
from (select cust_id,count(distinct prod_id) prodid
from (select cust_id,prod_id
from sales e,sale_item f
where e.order_no=f.order_no) g
group by cust_id
having count(distinct prod_id)>=3) h )
--18銆佹煡鎵捐嚦灝戜笌涓栫晫鎶鏈紑鍙戝叕鍙擱攢鍞浉鍚岀殑瀹㈡埛緙栧彿銆佸悕縐板拰鍟嗗搧緙栧彿銆佸晢鍝佸悕縐般佹暟閲忓拰閲戦
select a.cust_id,cust_name,d.prod_id,prod_name,qty,qty*unit_price
from customer a, product b, sales c, sale_item d
where a.cust_id=c.cust_id and d.prod_id=b.prod_id and
c.order_no=d.order_no and not exists
(select f.*
from customer x ,sales e, sale_item f
where cust_name='涓栫晫鎶鏈紑鍙戝叕鍙? and x.cust_id=e.cust_id and
e.order_no=f.order_no and not exists
( select g.*
from sale_item g, sales h
where g.prod_id = f.prod_id and g.order_no=h.order_no and
h.cust_id=a.cust_id)
)
19銆佹煡鎵捐〃涓墍鏈夊鍒樼殑鑱屽伐鐨勫伐鍙鳳紝閮ㄩ棬錛岃柂姘?br />select emp_no,emp_name,dept,salary
from employee
where emp_name like '鍒?'
20銆佹煡鎵炬墍鏈夊畾鍗曢噾棰濋珮浜?000鐨勬墍鏈夊鎴風紪鍙?br />select cust_id
from sales
where tot_amt>2000
21銆佺粺璁¤〃涓憳宸ョ殑钖按鍦?000-6000涔嬮棿鐨勪漢鏁?br />select count(*)as 浜烘暟
from employee
where salary between 4000 and 6000
22銆佹煡璇㈣〃涓殑鍚屼竴閮ㄩ棬鐨勮亴宸ョ殑騫沖潎宸ヨ祫錛屼絾鍙煡璇紓浣忓潃錛傛槸錛備笂嫻峰競錛傜殑鍛樺伐
select avg(salary) avg_sal,dept
from employee
where addr like '涓婃搗甯?'
group by dept
23銆佸皢琛ㄤ腑浣忓潃涓?涓婃搗甯?鐨勫憳宸ヤ綇鍧鏀逛負"鍖椾含甯?
update employee
set addr like '鍖椾含甯?
where addr like '涓婃搗甯?
24銆佹煡鎵句笟鍔¢儴鎴栦細璁¢儴鐨勫コ鍛樺伐鐨勫熀鏈俊鎭?br />select emp_no,emp_name,dept
from employee
where sex='F'and dept in ('涓氬姟','浼氳')
25銆佹樉紺烘瘡縐嶄駭鍝佺殑閿鍞噾棰濇誨拰錛屽茍渚濋攢鍞噾棰濈敱澶у埌灝忚緭鍑恒?br />select prod_id ,sum(qty*unit_price)
from sale_item
group by prod_id
order by sum(qty*unit_price) desc
26銆侀夊彇緙栧彿鐣屼簬'C0001'鍜?C0004'鐨勫鎴風紪鍙楓佸鎴峰悕縐般佸鎴峰湴鍧銆?br />select CUST_ID,cust_name,addr
from customer
where cust_id between 'C0001' AND 'C0004'
27銆佽綆楀嚭涓鍏遍攢鍞簡鍑犵浜у搧銆?br />select count(distinct prod_id) as '鍏遍攢鍞駭鍝佹暟'
from sale_item
28銆佸皢涓氬姟閮ㄥ憳宸ョ殑钖按涓婅皟3%銆?br />update employee
set salary=salary*1.03
where dept='涓氬姟'
29銆佺敱employee琛ㄤ腑鏌ユ壘鍑鴻柂姘存渶浣庣殑鍛樺伐淇℃伅銆?br />select *
from employee
where salary=
(select min(salary )
from employee )
30銆佷嬌鐢╦oin鏌ヨ瀹㈡埛濮撳悕涓?瀹㈡埛涓?鎵璐揣鐗╃殑"瀹㈡埛鍚嶇О","瀹氬崟閲戦","瀹氳揣鏃ユ湡","鐢佃瘽鍙風爜"
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榪欏ぉ鎵鎺ユ瘡涓寮犺鍗曠殑閲戦"鐨勬墍鏈夎鍗曘?br />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'浜у搧鐨勫鉤鍧囬攢鍞崟浠?br />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銆佹壘鍑哄悓涓澶╄繘鍏ュ叕鍙告湇鍔$殑鍛樺伐
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銆佹壘鍑虹洰鍓嶄笟緇╄秴榪?32000鍏冪殑鍛樺伐緙栧彿鍜屽鍚嶃?br />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琛ㄤ腑鎵鏈夊コ鑱屽伐鐨勫鉤鍧囧伐璧勫拰浣忓潃鍦紓涓婃搗甯傦紓鐨勬墍鏈夊コ鑱屽伐鐨勫鉤鍧囧伐璧?br />select avg(salary)
from employee
where sex like 'f'
union
select avg(salary)
from employee
where sex like 'f' and addr like '涓婃搗甯?'
37銆佸湪employee琛ㄤ腑鏌ヨ钖按瓚呰繃鍛樺伐騫沖潎钖按鐨勫憳宸ヤ俊鎭?br />Select *
from employee
where salary>( select avg(salary)
from employee)
38銆?鎵懼嚭鐩墠閿鍞笟緇╄秴榪?0000鍏冪殑涓氬姟鍛樼紪鍙峰強閿鍞笟緇╋紝騫舵寜閿鍞笟緇╀粠澶у埌灝忔帓搴忋?br />Select sale_id ,sum(tot_amt)
from sales
group by sale_id
having sum(tot_amt)>10000
order by sum(tot_amt) desc
39銆?鎵懼嚭鍏徃鐢蜂笟鍔″憳鎵鎺ヤ笖璁㈠崟閲戦瓚呰繃2000鍏冪殑璁㈠崟鍙峰強璁㈠崟閲戦銆?
Select order_no,tot_amt
From sales ,employee
Where sale_id=emp_no and sex='M' and tot_amt>2000
40銆?鏌ヨsales琛ㄤ腑璁㈠崟閲戦鏈楂樼殑璁㈠崟鍙峰強璁㈠崟閲戦銆?br />Select order_no,tot_amt from sales
where tot_amt=(select max(tot_amt) from sales)
41銆?鏌ヨ鍦ㄦ瘡寮犺鍗曚腑璁㈣喘閲戦瓚呰繃4000鍏冪殑瀹㈡埛鍚嶅強鍏跺湴鍧銆?br />Select cust_name,addr from customer a,sales b
where a.cust_id=b.cust_id and tot_amt>4000
42銆?姹傚嚭姣忎綅瀹㈡埛鐨勬昏璐噾棰濓紝鏄劇ず鍑哄鎴峰彿鍙婃昏璐噾棰濓紝騫舵寜鎬昏璐噾棰濋檷搴忔帓鍒椼?br />Select cust_id,sum(tot_amt) from sales
Group by cust_id
Order by sum(tot_amt) desc
43銆?姹傛瘡浣嶅鎴瘋璐殑姣忕浜у搧鐨勬繪暟閲忓強騫沖潎鍗曚環錛屽茍鎸夊鎴峰彿錛屼駭鍝佸彿浠庡皬鍒板ぇ鎺掑垪銆?br />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
Group by cust_id,prod_id
Order by cust_id,prod_id
44銆?鏌ヨ璁㈣喘浜嗕笁縐嶄互涓婁駭鍝佺殑璁㈠崟鍙楓?br />Select order_no
from sale_item
Group by order_no
Having count(*)>3
45銆?鏌ヨ璁㈣喘鐨勪駭鍝佽嚦灝戝寘鍚簡璁㈠崟3鍙蜂腑鎵璁㈣喘浜у搧鐨勮鍗曘?br />Select distinct order_no
From sale_item a
Where order_no<>'3'and not exists (
Select * from sale_item b where order_no ='3' and not exists
(select * from sale_item c where c.order_no=a.order_no and c.prod_id=b.prod_id))
46銆?鍦╯ales琛ㄤ腑鏌ユ壘鍑鴻鍗曢噾棰濆ぇ浜?E0013涓氬姟鍛樺湪1996/11/10榪欏ぉ鎵鎺ユ瘡涓寮犺鍗曠殑閲戦"鐨勬墍鏈夎鍗曪紝騫舵樉紺烘壙鎺ヨ繖浜涜鍗曠殑涓氬姟鍛樺拰璇ヨ鍗曠殑閲戦銆?br />Select sale_id,tot_amt from sales
where tot_amt>all(select tot_amt
from sales
where sale_id='E0013' and order_date='1996-11-10')
47銆?鏌ヨ鏈壙鎺ヤ笟鍔$殑鍛樺伐鐨勪俊鎭?br />Select *
From employee a
Where not exists
(select * from sales b where a.emp_no=b.sale_id)
48銆?鏌ヨ鏉ヨ嚜涓婃搗甯傜殑瀹㈡埛鐨勫鍚嶏紝鐢佃瘽銆佽鍗曞彿鍙婅鍗曢噾棰濄?br />Select cust_name,tel_no,order_no,tot_amt
From customer a ,sales b
Where a.cust_id=b.cust_id and addr='涓婃搗甯?
49銆?鏌ヨ姣忎綅涓氬姟鍛樺悇涓湀鐨勪笟緇╋紝騫舵寜涓氬姟鍛樼紪鍙楓佹湀浠介檷搴忔帓搴忋?br />Select sale_id,month(order_date), sum(tot_amt)
from sales
group by sale_id,month(order_date)
order by sale_id,month(order_date) desc
50銆?姹傛瘡縐嶄駭鍝佺殑鎬婚攢鍞暟閲忓強鎬婚攢鍞噾棰濓紝瑕佹眰鏄劇ず鍑轟駭鍝佺紪鍙楓佷駭鍝佸悕縐幫紝鎬繪暟閲忓強鎬婚噾棰濓紝騫舵寜浜у搧鍙蜂粠灝忓埌澶ф帓鍒椼?
Select a.prod_id,prod_name,sum(qty),sum(qty*unit_price)
From sale_item a,product b
Where a.prod_id=b.prod_id
Group by a.prod_id,prod_name
Order by a.prod_id
51銆?鏌ヨ鎬昏璐噾棰濊秴榪?C0002'瀹㈡埛鐨勬昏璐噾棰濈殑瀹㈡埛鍙鳳紝瀹㈡埛鍚嶅強鍏朵綇鍧銆?br />Select cust_id, cust_name,addr
From customer
Where cust_id in (select cust_id from sales
Group by cust_id
Having sum(tot_amt)>
(Select sum(tot_amt) from sales where cust_id='C0002'))
52銆?鏌ヨ涓氱嘩鏈濂界殑鐨勪笟鍔″憳鍙楓佷笟鍔″憳鍚嶅強鍏舵婚攢鍞噾棰濄?br />select emp_no,emp_name,sum(tot_amt)
from employee a,sales b
where a.emp_no=b.sale_id
group by emp_no,emp_name
having sum(tot_amt)=
(select max(totamt)
from (select sale_id,sum(tot_amt) totamt
from sales
group by sale_id) c)
53銆?鏌ヨ姣忎綅瀹㈡埛鎵璁㈣喘鐨勬瘡縐嶄駭鍝佺殑璇︾粏娓呭崟錛岃姹傛樉紺哄嚭瀹㈡埛鍙鳳紝瀹㈡埛鍚嶏紝浜у搧鍙鳳紝浜у搧鍚嶏紝鏁伴噺鍙婂崟浠楓?br />select a.cust_id, cust_name,c.prod_id,prod_name,qty, unit_price
from customer a,sales b, sale_item c ,product d
where a.cust_id=b.cust_id and b.order_no=c.order_no and c.prod_id=d.prod_id
54銆?姹傚悇閮ㄩ棬鐨勫鉤鍧囪柂姘達紝瑕佹眰鎸夊鉤鍧囪柂姘翠粠灝忓埌澶ф帓搴忋?br />select dept,avg(salary)
from employee
group by dept
order by avg(salary)