数据库原理及应用教程(第三版)部分简答题答案--陈志伯

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

(n0)BBAAmnBn(n0)BAm(n0)10ABABAB(a)(b)(c)1-14112P.712467122.P51+R2XR1XR113SSNoS1S2,S1119SNSexAge1718DeptDDeptAddr112144.P58XY156.RST2-12R1RSAB2RSa1b13R-S4ASa1b2a2b25R*T6RTAC7R.A=a2(RT)SAa1a1a2Bb2b3b2Aa1a1a2TCc1c2c3166.RST2-12RSR1RSAB2RSa1b13R-S4ASa1b2a2b25R*TS6RTAC7R.A=a2(RT)AAASAa1a1a2R-SAa1Bb1Bb2b3b2Aa1a1a2a1RSa1a2Bb2b2Bb1b2b2b317a1a26.RST2-121RSAB2RSa1b13R-S4ASa1b2a2b25R*T6RTAC7R.A=a2(RT)RR*TAa1a1a1a1a2Bb1b1b2b2b2Cc1c2c1c2c3Aa1a1a2TCc1c2c3186.RST2-12R1RSAB2RSa1b13R-S4ASa1b2a2b25R*T6RTAC7R.A=a2(RT)R.A=a2(RT)TAa2a2a2Bb2b2b2Aa1a1a2Cc1c2c3197.11-22(1)T1(2)18(3)(4)S1(5)(6)(7)(8)(9)C1C2(10)203P.1342P.1355212.SQL1234530100221Book(ISBN,title,publisher,edition,publicationdate,author,bookprice,purchaseprice,quantity)CREATETABLEBook(ISBNCHAR(17)PRIMARYKEY,TitleVARCHAR(50)NOTNULL,PublisherVARCHAR(50),EditionCHAR(2),P_dateCHAR(10),AuthorCHAR(8),B_priceMONEY,P_priceMONEY,B_QuantityINTCHECKQuantity=0)231Sales(date,ISBN,quantity,amount)CREATETABLESales(SNoCHAR(12)PRIMARYKEY,S_dateDATATIME,ISBNCHAR(17)NOTNULL,S_quantityINT,S_amountMONEY)242SELECTTitle,B_Quantity,P_priceB_QuantityASBalanceFROMBook3SELECTSUM(S_amount)ASAmount254SELECTS_date,Title,SUM(S_quantity)ASQuantity,SUM(S_amount)ASAmountFROMBook,SalesWHERESales.ISBN=Book.ISBNGROUPBYS_data,Title26530100SELECTTitleSUM(S_quantity)ASQuantityFROMBook,SalesWHERESales.ISBN=Book.ISBNAND(S_dateBETWEENGETDATE()-30ANDGETDATE())GROUPBYTitleHAVINGSUM(S_quantity)100ORDERBYSUM(S_quantity)DESC275.SCSCT3-25S#S1S2S3,,C#CNC1C2C3,,T#TNT1T2T3,,28SNAGE201919DEPTS#S1S1S2,,SAL8001200700C#GRC1C2C3808959COMMC#C1300150C2C1(1)SQLDDLSS#SN(2)(3)20(4)(5)SNC#GR(6)1000(7)C1(8)(9)S1C3,SC(10)S29(1)SQLDDLSS#SNCREATETABLES(S#CHAR(6)CONSTRAINTS_PrimPRIMARYKEY,SNCHAR(8)CONSTRAINTSN_CONTNOYNULL,AGEINT,DEPTVARCHAR(20))(2)CREATEVIEWS_SC_T(S#,SN,C#,T#)ASSELECTS.S#,SN,SC.C#,T#FROMS,SC,TWHERES.S#=SC.S#ANDSC.C#=T.C#30(3)20S#((DEPT=ANDAGE20)(S)SELECTS#FROMSWHEREDEPT=ANDAGE20(4)C#,CN((TN=%)(T*C)SELECTT.C#C#,CNFROMT,CWHERET.C#=C.C#ANDTNLIKE%31(5)SNC#GRSN,C#,GR((SN=)(S*SC)SELECTSN,C#,GRFROMS,SCWHERESN=ANDS.S#=SC.S#(6)1000SN,C#,GR(C#((SAL+COMM)1000(T))*S*SC)SELECTSN,SC.C#C#,GRFROMS,SC,TWHERE(SAL+COMM)1000ANDS.S#=SC.S#ANDSC.C#=T.C#32(7)C1SELECT*INTOS_TempFROMSWHEREC1NOTIN(SELECTC#FROMSCWHERES#=S.S#)SELECTSN,AVG(GR)ASAVGFROMS_TempJOINSCONS_Temp.S#=SC.S#GROUPBYS_Temp.S#HAVINGCOUNT(*)=2ORDERBYAVG(GR)DESC33(7)C1SELECTSN,AVG(GR)ASAVGFROMS,SCWHERES.S#=SC.S#GROUPBYS.S#HAVING(COUNT(*)=2)AND(S.S#NOTIN(SELECTS#FROMSCWHEREC#=C1))ORDERBYAVG(GR)DESC34(7)C1SELECTSN,AVG(GR)ASAVGFROMS,SCWHERES.S#=SC.S#AND(SC.S#ALL(SELECTS#FROMSCWHEREC#=C1))GROUPBYSC.S#HAVING(COUNT(*)=2)ORDERBYAVG(GR)DESC35(8)SN,CN(S*SC(C#,CN(SN=(S)*SC*C))SELECTSN,CNFROMS,SC,CWHERES.S#=SC.S#ANDSC.C#=C.C#ANDSC.C#IN(SELECTC#FROMS,SCWHERES.S#=SC.S#ANDSN=)36(9)S1C3,SCINSERTINTOSC(S#,C#)VALUES(S1,C3)(10)SDELETEFROMSWHERES#NOTIN(SELECTDISTINCTS#FROMSC)374P.174361220383.P1504.11396.RABCDF{ACCABACDAC}1AD+B+2R3FFmin4R5R3NF6RBCNF4012.RABCDEF{ACBDCDDECCEA}{ADABBECDEAE}ADABBECDEAEAa1a1b31b41a1Bb12a2a2b42b52Cb13b23b33a3b53Da4b24b34a4b54Eb15b25a5a5a54112.RABCDEF{ACBDCDDECCEA}{ADABBECDEAE}ADABBECDEAEAa1a1a1a1a1Bb12a2a2b42b52Ca3a3a3a3a3Da4a4a4a4a4Eb15b25a5a5a54220.4344F{}}45F{/}}//46F{}47F{}}48F{/}/495P.218126910501.DBMS51522.DBMADBMS536.549.UNDOROLLBACKREDO5510.CHECKCHECKCHECKCHECK56CHECKCHECKCHECKCHECK576P.24923P.25016582.6-21(a)(b)(c)E-RE-R593.1E-R2E-R3601.611.DBMS621.636.647P.29312P.2984.34651.662.SQLServer2000674.3CourseInsert_course2Insert_course268CREATEPROCEDUREInsert_Course(@cnochar(5),@cnchar(20),@cscorenumeric(6,2)=2)ASINSERTINTOCourseVALUES(@cno,@cn,@cscore)694.4Insert_courseCourseSQLInsert_courseInsert_course70USEStudyEXECInsert_Course@cno='03001',@cn='Database',@cscore=2SELECT*FROMCourseUSEStudyEXECInsert_Course@cno='03001',@cn='DatabaseSELECT*FROMCourse71

1 / 11
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功