版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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语句能得出想要的结果?(选择两项)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语句执行后会出现什么结果?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选项不正确,没结果,促销开始日期大于最大促销日期的(所有活动中最大的),并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-成--相当selectmax(ct)fromSELECTprod_category_id,COUNT(*)ctFROMproductsGROUPprod_category_idSELECTcount(COUNT(*))FROMproductsGROUPBYprod_category_id-成--相当SELECTcount(CT)FROM(SELECTCOUNT(*)CTFROMproductsGROUP)--修改一SELECTcount(CT)FROM(SELECTprod_category_id,COUNT(*)CTproductsGROUPBYprod_category_id--成--再修改一下,比较结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. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 你必须知道的那些事儿
- 2024年出售主焦煤矿山合同范本
- 2024年出售梁场回迁房协议书模板
- 2024年代驾车折叠车租车协议书模板
- 2024年便利店并购协议书模板模板
- 不良坐姿康复治疗方案
- 围绝经期饮食护理
- 创意美术培训汇报展示课
- 儿童脑出血的治疗方案
- 【数学】函数的概念与性质章末检测卷-2024-2025学年高一上学期数学人教A版(2019)必修第一册
- GB/T 29711-2023焊缝无损检测超声检测焊缝内部不连续的特征
- 世界各国国家代号、区号、时差
- JGT388-2012 风机过滤器机组
- 花木兰短剧剧本英文版
- 班主任技能大赛一等奖治班策略
- 全国高中青年数学教师优质课大赛一等奖《函数的单调性》课件
- 积极应对媒体正确舆情引导培训讲义课件
- 人教版六年级英语上册(PEP)课件【全册】
- 运维开发人员KPI绩效考核方案
- 起重机日常维护保养方案
- 民法典讲座-继承篇
评论
0/150
提交评论