版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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的用戶的名稱和等級(jí)SQL語句能得出想要的結(jié)果?(選擇兩項(xiàng))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í)行后會(huì)出現(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選項(xiàng)不正確,沒結(jié)果,促銷開始日期大于最大促銷日期的(所有活動(dòng)中最大的),并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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 《病理學(xué)傳染病》課件
- 2024年電能表修校工(中級(jí)工)職業(yè)鑒定考試題庫(含答案)
- 耐水硅膠FNG行業(yè)市場(chǎng)發(fā)展及發(fā)展趨勢(shì)與投資戰(zhàn)略研究報(bào)告
- 2025收藏品買賣合同范文
- 2024年度天津市公共營(yíng)養(yǎng)師之三級(jí)營(yíng)養(yǎng)師練習(xí)題及答案
- 2025清單計(jì)價(jià)規(guī)范下的工程合同
- 2024年度四川省公共營(yíng)養(yǎng)師之四級(jí)營(yíng)養(yǎng)師題庫附答案(典型題)
- 2024年度四川省公共營(yíng)養(yǎng)師之三級(jí)營(yíng)養(yǎng)師考前沖刺模擬試卷A卷含答案
- 2025合伙買車合同
- 2025年中國(guó)防腐油漆行業(yè)市場(chǎng)發(fā)展監(jiān)測(cè)及投資戰(zhàn)略咨詢報(bào)告
- 2024年國(guó)家開放大學(xué)本科《知識(shí)產(chǎn)權(quán)法》第一至四次形考任務(wù)試題及答案
- 國(guó)有企業(yè)考勤制度管理辦法
- 人教版六年級(jí)上冊(cè)道德與法治知識(shí)點(diǎn)
- 期貨從業(yè)資格(期貨基礎(chǔ)知識(shí))歷年真題試卷匯編27
- 人工智能學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
- 北師大版(2019)必修第二冊(cè)Unit 5 Humans and nature Lesson 3 Race to the pole教學(xué)設(shè)計(jì)
- 《毛概》23版學(xué)習(xí)通超星期末考試答案章節(jié)答案2024年
- 2024CSCO胰腺癌診療指南解讀
- 窗簾采購?fù)稑?biāo)方案(技術(shù)方案)
- 電力安全工作規(guī)程考試試題(答案)
- 2024-2030年串番茄行業(yè)市場(chǎng)發(fā)展分析及前景趨勢(shì)與投資研究報(bào)告
評(píng)論
0/150
提交評(píng)論