ocp051題庫(kù)筆記講解-1z0-v9.02解析_第1頁(yè)
ocp051題庫(kù)筆記講解-1z0-v9.02解析_第2頁(yè)
ocp051題庫(kù)筆記講解-1z0-v9.02解析_第3頁(yè)
ocp051題庫(kù)筆記講解-1z0-v9.02解析_第4頁(yè)
已閱讀5頁(yè),還剩6頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(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的用戶(hù)的名稱(chēng)和等級(jí)SQL語(yǔ)句能得出想要的結(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語(yǔ)句執(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)不正確,沒(méi)結(jié)果,促銷(xiāo)開(kāi)始日期大于最大促銷(xiāo)日期的(所有活動(dòng)中最大的),并INTERNET的商品,很明顯,不存在這樣的記錄。CINTERNET的開(kāi)始日期,然后>ALL,表示大于最大的開(kāi)始日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);----問(wèn)題出在這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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論