版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第4章答案4-1selectcorId,corNamefromcourses;4-2select*fromsc;4-3selectcorName,period*1.1fromcourses;4-4selectcorId,corName,round(period,0)fromcourses;4-5selectstuId,stuName,year(curdate())-year(birth)asagefromstudents;4-6selectdistinctcreditfromcourses;4-7select*fromstudentswheresex='男';4-8select*fromcourseswhereperiod<='40';4-9select*fromstudentswherebirth>='2003-1-1'andbirth<='2003-12-31';4-10select*fromstudentswherestuNamein('刘晨','王小敏','赵丽');4-11select*fromcourseswherecorNamelike'数据库';4-12select*fromcourseswherecorNamelike'____';4-13select*fromstudentswheretelNonotlike'22%';4-14select*fromstudentswherecommentisnull;4-15select*fromscwherecorId='001'andscore<='60';4-16select*fromstudentswherestuNamelike'张%'orstuNamelike'王%';4-17select*fromcoursesorderbycorld,corName,credit;4-18select*fromscwherestuId='210101001'orderbycorId,scoredesc;4-19select*fromcourseslimit3;4-20select*fromcoursesLIMIT5,4;4-21select*fromscwherestuId='210101001'LIMIT5;4-22selectCOUNT(corName)as总课程数fromcourses;4-23selectMAX(period)as最长时长,MIN(credit)as最低时长fromcourses;4-24selectSUM(score)as总成绩,AVG(score)as平均成绩fromscwherestuId='210101003';4-25selectclass,COUNT(*)AS人数fromstudentsgroupbyclass;4-26selectstuId,count(corId)as选课人数fromscgroupbycorId;4-27selectclass,count(stuId)as学生人数fromstudentsgroupbyclass;havingcount(stuId)<35;4-28selectcorId,count(stuId)as选课人数fromscgroupbycorIdhavingcount(stuId)<5;4-32selectcourses.*,sc.*fromcoursesinnerjoinsconcourses.corId=sc.corId;4-33selectstudents.stuId,stuName,score,strDatefromstudentsinnerjoinsconstudents.stuId=sc.stuIdwherestudents.stuId='210101001';4-34selectstudents.stuId,stuName,courses.corId,corName,scorefrom(studentsinnerjoinsconstudents.stuId=sc.stuId)innerjoincoursesoncourses.corId=sc.corIdwherescore<60;4-35selectstuName,corId,scorefromstudentsinnerjoinsconstudents.stuId=sc.stuIdwherestuName='张永立'andscore>=80;4-36selectstudents.stuId,stuName,avg(score)fromstudentsinnerjoinsconstudents.stuId=sc.stuIdgroupbystudents.stuId;4-37selectclass,corName,count(sc.stuId)as学生人数from(studentsinnerjoinsconstudents.stuId=sc.stuId)innerjoincoursesoncourses.corId=sc.corIdwherecorName='数据库'groupbyclass;4-38selectcourses.corId,corNamefromcoursesLEFTJOINsconcourses.corId=sc.corIdwheresc.corIdisnull;4-39selectstuId,score,strDatefromscwherecorIdin(selectcorId fromcourses wherecorName='操作系统');4-40select*fromcourseswherecredit>(selectcredit fromcourses wherecorName='操作系统');4-41SELECT*FROMstudentsWHEREbirth>All(SELECTbirth FROMstudents WHEREclass='计算机应用');4-42SELECT*FROMstudentsWHEREbirth>ANY(SELECTbirth FROMstudents WHEREclass='计算机应用');4-43select*fromscwherenotexists(select*fromcourses wheresc.corId=courses.couId);4-44select*fromcourseswhereperiod>‘54’unionselect*fromcourseswherecredit<’3’;4-45selectcorIdfromcourseswhereperiod>54unionselectdistinctcorIdfromsc;第5章答案5-1INSERTintostudentsVALUES('220102035','张小燕','电子商务','女','2003-12-25','22319874','zhangxiaoyan@163.com','null');5-2INSERTINTOsc(stuId,corId,score,strdate)VALUE('220102035','85','2022-9-2'),('220102035','002','70','2022-9-2'),('220102035','003','93','2022-9-1');5-3CREATETABLEscoreavg(stuidchar(3),avgscoreINT)INSERTINTOscoreavgSELECTstuId,avg(score)fromsccgupbystuId;5-4updatecoursessetperiod=36wherecorName='操作系统';5-5updatescsetscore=0wherestuIdin(selectstuIdfromstudents whereclass='计算机应用');5-6deletefromcourseswherecorName='操作系统'5-7deletefromscwherecorIdin(selectstuNamefromsc wherecorName='计算机应用')第6章答案6-1CREATEVIEWcourses1ASSELECT*FROMcoursesWHEREperiod>'54';6-2CREATEVIEWcourses2ASSELECT*FROMcoursesWHEREperiod>'54'WITHCHECKOPTIONS;6-3createviewfemale001(stuId,stUName,corId,score)asselectstudents.stuId,stuName,corId,scorefromstudentsinnerjoinsconstudnets.stuId=sc.stuIdwherecorId=‘001'andsex='女';6-4createviewfemale00180asselectstuId,stuName,corId,scorefromfemale001wherescore>'80';6-5creatviewstuavgscore(corId,avg)asselectcorId,round(avg(score),1)fromscgroupbycorId;6-6selectperiod,creditfromcourselwherecorName='数据库';6-7select*fromfemaie001wherescore>='60';6-8inereintocourses1values('065','大数据可视化技术','54','3');6-9updatecourselsetperiod=54wherecorName='数据库';6-10deletefromcourse1wherecorName='数据库';6-11dropviewcourse1;6-12createprocedureStuproc5(var_corNamevarchar(30))beginselectcorName,period,creditfromcourseswherecorName=var_corName;End6-13createprocedureStuproc6(var_corNamevarchar(30))beginselectstuId,scorefromcoursesinnerjoinsconcourses.corId=sc.corIdwherecorName=var_corName;EndcallStuproc6('数据库')6-14createprocedureStuproc7(invar_corIdchar(3),outvar_countint)beginselectcount(*)intovar_countfromscwherecorName=var_corId;End6-16dropprocedureStuproc5;6-17createtabledelcourses(corIdchar(9)primarykey,corNamevarchar(30));createtriggerdel_cor
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年大学大二(文物与博物馆学)文物学概论试题及答案
- 2026年职业知识(知识考核)考题及答案
- 2026年注册公用设备工程师(动力基础考试上)试题及答案
- 2025年大学第三学年(高分子材料与工程)高分子合成技术阶段测试试题及答案
- 火电厂热工自动化
- 深度解析(2026)《GBT 18286-2000信息技术 文本通信用控制功能》(2026年)深度解析
- 深度解析(2026)《GBT 18017.2-1999订舱确认报文 第2部分订舱确认报文子集 订舱确认报文》
- 深度解析(2026)《GBT 17848-1999牺牲阳极电化学性能试验方法》
- 深度解析(2026)《GBT 17706-1999销售预测报文》
- 深度解析(2026)《GBT 8210-2011柑桔鲜果检验方法》
- 2023年广东清远市清城区人民检察院招聘专项工作聘员4人笔试参考题库(共500题)答案详解版
- 3S技术在景观生态学中的应用解析课件
- 初中《阳光学业评价》英语八年级上册(含答案)
- 列车员个人先进事迹范文
- 安全用电防止触电主题教育PPT模板
- 国家开放大学《理工英语3》章节测试参考答案
- 钢结构施工安全晨会记录
- JJG 924-2010转矩转速测量装置
- 通信工程设计基础doc资料
- 枪支使用管理相关法律法规-共35张课件
- 流体机械原理:05第四章 泵的汽蚀
评论
0/150
提交评论