您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 人事档案/员工关系 > 数据库原理与应用教程(第三版)第四章课后习题答案
1.SELECT*FROMStudent结果:2.SELECTSname姓名,Sage年龄FROMStudentWHERESdept='计算机系'结果:3.SELECTSno学号,Cno课程号,Grade成绩FROMSCWHEREGradeBETWEEN70AND804.SELECTSname姓名,Sage年龄FROMStudentWHERESdept='计算机系'ANDSage=18ANDSage=20ANDSsex='男'5.SELECTMAX(Grade)最高分数FROMSCWHERECno='c01'6.SELECTMAX(Sage)最大年龄,MIN(Sage)最小年龄FROMStudentWHERESdept='计算机系'7.SELECTSdept系名,COUNT(*)学生人数FROMStudentGROUPBYSdept8.SELECTCname课程名,COUNT(*)选课门数,MAX(Grade)最高分FROMCourse,SCGROUPBYCname9.SELECTSno学号,COUNT(*)选课门数,SUM(Grade)总成绩FROMSCGROUPBYSnoORDERBY'选课门数'ASC10.SELECTSno学号,SUM(Grade)总成绩FROMSCGROUPBYSnoHAVINGSUM(Grade)20010.CREATTABLEBOOK(Snobooknchar(6)PRIMARYKEY,Snamebooknvarchar(30)NBOTNULL,Writerchar(10)NOTNULL,Timesmalldatetime,Pricenumeric(3,1))CREATTABLEBOOKSHOP(Snoshopnchar(6)PRIMARYKEY,Snameshopnvarchar(30)NOTNULL,Telchar(8)CHECK(Tel=0ANDTel=9),Placenchar(40),Snoemailchar(6))CREATTABLEBOOKSELL(Snobooknchar(6)NOTNULL,Snoshopnchar(6)NOTNULL,SelltimesmalltimeNOTNULL,Snoselltinyint,PRIMARYKEY(Snobook,Snoshop,Selltime),FOREIGNKEY(Snobook)REFERENCESBOOK(Snobook),FOREIGNKEY(Snoshop)REFERENCESBOOK(BOOKSHOP))11.ALTERTABLEBOOKADDNomberintADDCONSTRAINTDF-NomberCHECK(Nomber1000)12.ALTERTABLEBOOKSHOPDROPCOLUMNTel13.ALTERTABLEBOOKSELLALTERCOLUMNSnosellint
本文标题:数据库原理与应用教程(第三版)第四章课后习题答案
链接地址:https://www.777doc.com/doc-2428129 .html