



版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1Z0-051V9.02141-145ViewtheExhibitandexaminethestructureofCUSTOMERSandGRADEStables.Youneedtodisplaynamesandgradesofcustomerswhohavethehighestcreditlimit.WhichtwoSQLstatementswould plishthetask?(Choosetwo.)A.SELECTcustname,gradeFROMcustomers,WHERE(SELECTMAX(cust_credit_limit)FROMcustomers)BETWEENstartvalandendval;B.SELECTcustname,gradeFROMcustomers,gradesWHERE(SELECTMAX(cust_credit_limit)FROMcustomers)BETWEENstartvalandendvalANDcust_credit_limitBETWEENstartvalANDC.SELECTcustname,gradeFROMcustomers,gradesWHEREcust_credit_limit=(SELECTMAX(cust_credit_limit)FROMANDcust_credit_limitBETWEENstartvalANDD.SELECTcustname,gradeFROMcustomers,gradesWHEREcust_credit_limitIN(SELECTMAX(cust_credit_limit)FROMANDMAX(cust_credit_limit)BETWEENstartvalANDCUSTOMERSCUSTOMERSandGRADEScreditlimit的用戶的名稱和等級SQL語句能得出想要的結(jié)果?(選擇兩項)BETWEEN...ANDdroptablecust141;droptablegrade141;createtablecust141(cnamevarchar2(10),crlnumber);insertintocust141values('zs',65);insertintocust141values('ls',75);insertintocust141values('ww',85);insertintocust141valuescreatetablegrade141(gnamevarchar2(2),startvalnumber,endvalinsertintograde141values('A',90,99);insertintograde141values('B',80,89);insertintograde141values('C',70,79);insertintograde141valuesSELECTCNAME,FROMcust141,WHERE(SELECTMAX(CRL)FROMcust141)BETWEENstartvalSELECTCNAME,FROMcust141,WHERE(SELECTMAX(CRL)FROMcust141)BETWEENstartvalANDCRLBETWEENstartvalANDSELECTSELECTCNAME,FROMcust141,WHEREcrl=(SELECTMAX(crl)FROMANDcrlBETWEENstartvalANDSELECTcustname,FROMcust141,WHERECRLIN(SELECTMAX(CRL)FROMANDMAX(CRL)BETWEENstartvalANDendval;--SELECTMAX(CRL)FROMcust141WHERECRL<90HAVINGViewtheExhibitandexaminethestructureofthePRODUCTSEvaluatethefollowingSQL>SELECTprod_nameFROMproductsWHEREprod_idIN(SELECTprod_idFROMproductsWHEREprod_list_price(SELECTMAX(prod_list_price)FROMproductsWHEREprod_list_price(SELECTMAX(prod_list_price)Whatwouldbe eofexecutingtheaboveSQLItproducesanItshowsthenamesofallproductsintheItshowsthenamesofproductswhoselistpriceisthesecondhighestinthetable.Itshowsthenamesofallproductswhoselistpriceislessthanthe umlistprice.SQL語句執(zhí)行后會出現(xiàn)什么結(jié)果?SELECTMAX(prod_list_priceFROMproducts,得出SELECTMAX(prod_list_price)FROMproductsWHEREprod_list_price<(SELECTMAX(prod_list_price)FROMSELECTprod_nameFROMproductsWHEREprod_idIN(SELECTFROMWHEREprod_list_price(SELECTMAX(prod_list_price)FROMproductsWHEREprod_list_price(SELECTMAX(prod_list_price)FROM)DROPTABLECREATETABLET142(prod_idNUMBER,prod_nameVARCHAR2(10),prod_list_priceNUMBER);INSERTINTOT142VALUES(1,'A',100);INSERTINTOT142VALUESINSERTINTOT142VALUESSELECTSELECTFROMWHEREprod_id(SELECTFROMWHEREprod_list_price(SELECTMAX(prod_list_price)FROMT142WHEREprod_list_price(SELECTMAX(prod_list_price)FROM)ViewtheExhibitandexaminethestructureofthePROMOTIONSYouhavetogenerateareportthatdisplaysthepromonameandstartdateforallpromosthatstartedafterthelastpromointhe'INTERNET'category.Whichquerywouldgiveyoutherequiredoutput?A.SELECTpromo_name,promo_begin_dateFROMWHEREpromo_begin_date>ALL(SELECTMAX(promo_begin_date)FROMpromotions)ANDpromo_category='INTERNET';B.SELECTpromo_name,promo_begin_dateFROMpromotionsWHEREpromo_begin_dateIN(SELECTpromo_begin_dateFROMWHEREpromo_category=C.SELECTpromo_name,promo_begin_dateFROMpromotionsWHEREpromo_begin_date>ALL(SELECTpromo_begin_dateFROMpromotionsWHEREpromo_category=D.SELECTpromo_name,promo_begin_dateFROMpromotionsWHEREpromo_begin_date>ANY(SELECTpromo_begin_dateFROMpromotionsWHEREpromo_category=promonamestartA選項不正確,沒結(jié)果,促銷開始日期大于最大促銷日期的(所有活動中最大的),并INTERNET的商品,很明顯,不存在這樣的記錄。CINTERNET的開始日期,然后>ALL,表示大于最大的開始日SELECTpromo_name,FROMWHEREpromo_begin_date>ALL(SELECTFROMWHEREpromo_category=DROPTABLECREATETABLE(promo_nameVARCHAR2(3),promo_begin_datepromo_categoryINSERTINTO T143VALUES('A',SYSDATE,'TV');INSERTINTO T143VALUES('B',SYSDATE+1,'TV');INSERT T143VALUES('C',SYSDATE-INSERTINSERT T143VALUES('D',SYSDATE-SELECTpromo_name,FROMWHEREpromo_begin_date>ALL(SELECTFROMWHEREpromo_category=ViewtheExhibitandexaminethestructureofthePRODUCTSYouwanttodisplaythecategorywiththe umnumberofitems.Youissuethefollowingquery:SQL>SELECTCOUNT(*),prod_category_idFROMproductsGROUPBYHAVINGCOUNT(*)=(SELECTMAX(COUNT(*))FROMWhatis ItexecutessuccessfullyandgivesthecorrectItexecutessuccessfullybutdoesnotgivethecorrectItgeneratesanerrorbecausethesubquerydoesnothaveaGROUPBYclause.Itgeneratesanerrorbecause=isnotvalidandshouldbereplacedbytheINoperator.groupby子句,countSELECTCOUNT(*),FROMGROUPBYHAVINGCOUNT(*)=(SELECTMAX(COUNT(*))FROMproducts);----問題出在這SELECTMAX(COUNT(*))FROMproducts--SELECTMAX(CTFROMSELECTCOUNT(*CTFROMproducts--成SELECTprod_category_id,MAX(COUNT(*))FROMproductsGROUPprod_category_id--SELECTMAX(COUNT(*))FROMproductsGROUPBYprod_category_id-成--相當(dāng)selectmax(ct)fromSELECTprod_category_id,COUNT(*)ctFROMproductsGROUPprod_category_idSELECTcount(COUNT(*))FROMproductsGROUPBYprod_category_id-成--相當(dāng)SELECTcount(CT)FROM(SELECTCOUNT(*)CTFROMproductsGROUP)--修改一SELECTcount(CT)FROM(SELECTprod_category_id,COUNT(*)CTproductsGROUPBYprod_category_id--成--再修改一下,比較結(jié)SELECTprod_category_id,count(CT)FROM(SELECTprod_category_id,COUNT(*CTFROMproductsGROUPBYprod_category_id)GROUPBYprod_category_id--成功SELECTCOUNT(*),FROMGROUPBYHAVINGHAVINGCOUNT(*)=(SELECTMAX(COUNT(*))FROMproductsBYprod_category_id);--SELECTCOUNT(*),FROMGROUPBYHAVINGCOUNT(*)=(SELECTMAX(ct)FROM(selectCOUNT(*)fromproductsgroupbyprod_category_id));-SELECTCOUNT(*),FROMGROUPBYHAVINGCOUNT(*)=(SELECTMAX(ct)FROM(selectCOUNT(*)fromT143groupbypromo_category));-SELECT*FROMINSERT T143VALUES('E',SYSDATE-SELECTCOUNT(*),FROMGROUPBYHAVINGCOUNT(*)=(SELECTMAX(ct)FROM(selectCOUNT(*)fromT143groupbypromo_category));-ViewtheExhibitandexaminethestructureoftheCUSTOMERSYouissuethefollowingSQLstatementontheCUSTOMERStabletodisplaythecustomerswhoareinthesamecountryascustomerswiththelastname'KING'andwhosecreditlimitislessthantheumcreditlimitincountriesthathavecustomerswiththelastname'KING':SQL>SELECTcust_id,FROMcustomersWHEREcountry_idIN(SELECTcountry_idFROMcustomersWHERE=ANDcust_credit_limit(SELECTMAX(cust_credit_limit)FROMcustomersWHEREcountry_idIN(SELECTFROMWHEREcust_last_name='King'));Whichstatementistrueregarding eoftheaboveItexecutesandshowstherequiredItproducesanerrorandthe<operatorshouldbereplaced<ALLtogettherequiredItproducesanerrorandthe<operatorshouldbereplaced<ANYtogettherequiredItproducesanerrorandtheINoperatorshouldbereplaced=intheWHEREclauseofthemainquerytogettherequiredSQLla
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 共同商標轉(zhuǎn)讓合同范例
- 切削液購銷合同范例
- 共同購車協(xié)議合同范例
- 公司買房購房合同范例
- 中建鋼筋合同范例
- 農(nóng)村自來水放水員合同范例
- 井蓋購銷合同范例
- 兒童水上樂園合同范例
- 兼職泊車勞務(wù)合同范例
- led屏托管協(xié)議合同范例
- 第28課 改革開放和社會主義現(xiàn)代化建設(shè)的巨大成就 教學(xué)設(shè)計(表格式)必修 中外歷史綱要(上)
- DB21-T 3943-2024 消防控制室管理
- 規(guī)劃課題申報范例:高校畢業(yè)生高質(zhì)量就業(yè)服務(wù)體系建設(shè)研究(附可修改技術(shù)路線圖)
- 2023年高考地理專題復(fù)習(xí)新題典題精練-大氣受熱過程(原卷版)
- 教師資格考試高級中學(xué)數(shù)學(xué)面試試題與參考答案(2024年)
- 高速公路改建拆除施工方案
- 護理不良事件相關(guān)知識考核試題及答案
- 安全文明施工標準化現(xiàn)場管理規(guī)定
- 循環(huán)流化床鍋爐改機械爐排爐項目可行性研究報告模板-立項備案
- 正常分娩過程與護理
- DB11T 3034-2023 建筑消防設(shè)施檢測服務(wù)規(guī)范
評論
0/150
提交評論