




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1Z0-051V9.022017-6-5ExaminethedataintheORD_ITEMS Youwanttofindoutifthereisanyiteminthetableforwhichtheaverageumtyismorethan50.YouissuethefollowingSQL>SELECTFROMord_itemsGROUPBYitem_noHAVINGWhichstatementistrueregarding eofthisItexecutessuccessfullyandgivesthecorrectItgivesanerrorbecausetheHAVINGclauseisnotItexecutessuccessfullybutdoesnotgivethecorrectItgivesanerrorbecausetheGROUPBYexpressionisnotD.GROUPBY表達式無效。HAVING2個組函數(shù),且嵌套內(nèi)的值已經(jīng)是最大值了,且只有一個,再createtablet116(ORD_NOnumber,ITEM_NOnumber,QTYnumber);insertintot116values(1,111,10);insertintot116valuesinsertintot116values(1,333,30);insertintot116values(2,333,30);insertintot116values(2,444,40);insertintot116valuesselect*fromSELECTFROMGROUPBYHAVINGSELECTFROMGROUPBYHAVINGSELECTFROMGROUPBYSELECTFROMGROUPBYSELECT(20+30+40+40)/4FROMSELECTFROMGROUPBYSELECTFROMGROUPBYHAVINGMAX(qty)selectavg(mq)from(SELECTMAX(qtyFROMGROUPBY)SELECTSELECTFROMGROUPBYHAVINGMAX(qty)selectavg(mq)from(SELECTMAX(qty)mqFROMGROUPBYHAVINGMAX(qty))WhichstatementsaretrueregardingtheWHEREandHAVINGclausesinaSELECTstatement?(Chooseallthatapply.)TheHAVINGclausecanbeusedwithaggregatefunctionsinTheWHEREclausecanbeusedtoexcluderowsafterdividingthemintogroups.TheWHEREclausecanbeusedtoexcluderowsbeforedividingthemintogroups.TheaggregatefunctionsandcolumnsusedintheHAVINGclausemustbespecifiedintheSELECTlistofthequery.TheWHEREandHAVINGclausescanbeusedinthesamestatementonlyiftheyareappliedtodifferentcolumnsinthetable.A.HAVING子句能在子查詢中使用聚合函數(shù)。createtablet117(IDnumber,QTYnumber);insertintot117values(1,10);insertintot117valuesinsertintot117values(1,30);insertintot117values(2,30);insertintot117values(2,40);insertintot117valuesSELECTid,FROMGROUPBYIDHAVINGAVG(qty)>20;SELECT*FROMSELECTID,AVG(qty)FROMGROUPBYSELECT*FROMT117WHEREQTY>10SELECTID,AVG(qty)FROMt117WHEREQTY>10GROUPBYIDSELECTID,AVG(qty)FROMWHEREQTY>10GROUPBYID--;HAVINGAVG(qty)>30SELECTID,AVG(qty)FROMWHEREQTY>10GROUPBYIDHAVINGSELECTAVG(qty)FROMWHEREQTY>10GROUPBYIDHAVINGSELECTID,max(qty)FROMWHEREQTY>10GROUPBYIDHAVINGHAVINGSELECTID,AVG(qty)FROMWHEREQTY>10GROUPBYIDHAVINGViewtheExhibitandexaminethestructureofthePROMOTIONSExaminethefollowingtwoSQLStatementSQL>SELECTpromo_category,SUM(promo_cost)FROMpromotionsWHEREpromo_end_date-promo_begin_date>30GROUPBYpromo_category;StatementSQL>SELECTpromo_category,sum(promo_cost)FROMpromotionsGROUPBYHAVINGMIN(promo_end_date-WhichstatementistrueregardingtheabovetwoSQLstatement1givesanerror,statement2executesstatement2givesanerror,statement1executesstatement1andstatement2executesuccessfullyandgivethesameoutputstatement1andstatement2executesuccessfullyandgiveadifferentoutput評估下面的2個語句21執(zhí)行成功。SELECTpromo_category,SUM(promo_cost)FROMpromotionsWHEREpromo_end_date-promo_begin_date>30GROUPBYpromo_category;SELECTpromo_category,sum(promo_cost)FROMpromotionsGROUPBYHAVINGMIN(promo_end_date-ExaminethedataintheORD_ITEMSORD_NOITEM_NO111223EvaluatethefollowingSQL>SELECTitem_no,FROMHAVINGAVG(qty)>MIN(qty)*GROUPBYWhichstatementistrueregarding eoftheaboveItgivesanerrorbecausetheHAVINGclauseshouldbespecifiedaftertheGROUPBYclause.ItgivesanerrorbecausealltheaggregatefunctionsusedintheHAVINGclausemustbespecifiedintheSELECTlist.Itdisystheitemnoswiththeiraveragetywheretheaveragetyismorethandoubletheminimumtyofthatiteminthetable.Itdisystheitemnoswiththeiraveragetywhereaveragetyismorethandoubletheoverallminimumtyofalltheitemsinthetable.HAVINGGROUPBYA選項不正確,HAVINGGROUPBYSELECTitem_no,FROMHAVINGAVG(qty)>MIN(qty)*GROUPBYSELECTitem_no,AVG(qty),MIN(qty),MIN(qty)*2FROMT116GROUPBYHAVINGAVG(qty)>MIN(qty)*ViewtheExhibits andexaminethestructuresofthePRODUCTS,SALES,andCUSTOMERStables.Yd_id,prod_name,prod_list_price,ty_sold,cust_last_nameFROMproductspNATURALJOINsalessNATURALJOINcustomersWHEREprod_idWhichstatementistrueregarding eofthisItexecutesItproducesanerrorbecausetheNATURALjoincanbeusedonlywithtwotables.ItproducesanerrorbecauseacolumnusedintheNATURALjoincannothaveaqualifier.ItproducesanerrorbecauseallcolumnsusedintheNATURALjoinshouldhaveaqualifier.PRODUCTS,SALES,andCUSTOMERSSELECTd_id,prod_name,prod_list_price, FROMproductspNATURALJOINsalessNATURALJOINcustomerscWHEREprod_id=148;--SELECTprod_id,prod_name,prod_list_price, FROMproductsNATURALJOINsalessNATURALJOINcustomerscWHEREprod_id=148;SELECTprod_id,cust_id,d_name, ty_sold,FROMproductsNATURALJOINsalessNATURALJOINcustomerscWHEREprod_id=148;NATURAL FROMtablelNATURALJOINDROPTABLEt120X;DROPTABLEt120Y;DROPTABLEcreatetablet120X(anumber,bnumber,cnumber);createtablet120Y(bnumber,cnumber,dnumber);createtablet120Z(dnumber,enumber,fINSERTINTOT120XVALUESINSERTINTOT120YVALUES(2,3,4);INSERTINTOT120YVALUES(2,3,40);INSERTINTOT120YVALUESINSERTINTOT120ZVALUES(4,5,6);INSERTINTOT120ZVAL
溫馨提示
- 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 企業(yè)核心機密保護合同模板
- 市場營銷合作合同模板:品牌推廣專用
- 數(shù)據(jù)外包服務(wù)合同轉(zhuǎn)讓合同
- 標準勞動合同解除樣本
- 加盟連鎖店經(jīng)營合同樣本
- 合同約定催款函格式專業(yè)版
- 建筑物拆除的施工安全管理考核試卷
- 機床制造中的人力資源管理策略考核試卷
- 農(nóng)業(yè)科學(xué)中的農(nóng)村居民收入與消費考核試卷
- 安全網(wǎng)絡(luò)數(shù)據(jù)安全審計流程自動化考核試卷
- 2025復(fù)工復(fù)產(chǎn)安全教育培訓(xùn)
- 2024年叉車司機車輛基本操作知識考試題庫及答案(共70題)
- 工業(yè)統(tǒng)計知識培訓(xùn)
- 2025年臨沂科技職業(yè)學(xué)院高職單招語文2018-2024歷年參考題庫頻考點含答案解析
- 保密協(xié)議范本
- 2025年臨床醫(yī)師定期考核必考復(fù)習(xí)題庫及答案(1080題)
- 電梯維保知識培訓(xùn)課件
- CNAS-R02:2023公正性和保密規(guī)則
- 2024-2030年中國骨傳導(dǎo)植入式助聽器和耳機行業(yè)應(yīng)用態(tài)勢與需求前景預(yù)測報告
- 現(xiàn)場物資安全管理
- 2024解析:第二十章電與磁-講核心(解析版)
評論
0/150
提交評論