下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1001查询全体男同学信息情况select*fromstudentwheresex='男'1002查询选修了1号课的学生的学号和成绩selectsno,gradefromscwherecno='1'1003查询1989年以前出生的学生学号和姓名和出生日期(提示请用year(csrq)函数来取出生年号)selectsno,sname,csrqfromstudentwhereyear(csrq)<19891004查询信息系所有女生的学号,姓名,及所在系selectsno,sname,sdeptfromstudentwheresdept='信息系'andsex='女'1005查询课程名是数据库的课程号和学分selectcno,ccreditfromcoursewherecname='数据库'1006查询先行课号为5的课程号和课程名selectcno,cnamefromcoursewherecpno='5'1007查询英语系90后的学生情况(注90年后出生的)select*fromstudentwheresdept='英语系'andyear(csrq)>=19901008查询计算机系或信息系中年龄超过21岁的同学情况.(设当前年为2010年,提示用当前年减去出生年再与21岁比较)select*fromstudentwhere(sdept='计算机系'orsdept='信息系')and2010-year(csrq)>211009请将3号课及4号课学生的学号课程号及成绩显示出来selectsno,cno,gradefromscwherecno='3'orcno='4'1010查询所有先行课程号为0且学分为2的课程名,先行课程号,及学分selectcname,cpno,ccreditfromcoursewherecpno='0'andccredit=22010查询学分为3以上(不含3),且课程名中包含着'数据'二字的所有课程名及学分selectcname,ccreditfromcoursewhereccredit>3andcnamelike'数据%'2001查询年龄在20-23岁之间(含20与23岁)的学生姓名,系别,年龄(请不要用between语句提交)设当前年为2010年selectsname,sdept,(2010-year(csrq))asagefromstudentwhere(2010-year(csrq))>=20and(2010-year(csrq))<=232002查询选修过课程且成绩大于80分的所有学生的学号(不许重复)selectdistinctsnofromscwheregrade>802003请将选修了1号课或3号课课程的同学按课程号升序,成绩降序排序select*fromscwherecno='1'orcno='3'orderbycno,gradedesc2004请将选了1号课程且成绩在60分以上的同学按成绩降序排序select*fromscwherecno='1'andgrade>60orderbygradedesc2005查询选修了1号课的成绩大于85分的学号和成绩selectsno,gradefromscwherecno='1'andgrade>852006查询所有李姓的09级同学情况select*fromstudentwheresnamelike'李%'andsnolike'09%'2007查询所有两字姓名的张姓85年后出生同学的姓名,性别与系别selectsname,sex,sdeptfromstudentwheresnamelike'张_'andyear(csrq)>19852008查询名字中第3个字为铃4月4号出生的学生的姓名和学号selectsname,snofromstudentwheresnamelike'__铃'andmonth(csrq)=4andday(csrq)=42009查询信息系所有不姓刘的同学的学号和姓名selectsno,snamefromstudentwheresdept='信息系'andsnamenotlike'刘%'3001查询所有选修过数据库或信息系统课的学生的姓名,课程名及成绩selectsname,cname,gradefromstudent,sc,coursewherestudent.sno=sc.snoando=oandcnamein('数据库','信息系统')3002查询选修了3号课且成绩大于80分的男同学的姓名,课程号及成绩selectsname,cno,gradefromstudent,scwherestudent.sno=sc.snoandcno='3'andgrade>80andsex='男'3003查询选1号课的女生姓名,课程号及成绩,并按课程号升序,成绩降序排序selectsname,cno,gradefromstudent,scwherestudent.sno=sc.snoandcno='1'andsex='女'orderbycno,gradedesc3004查询计算机系选修了数据库课的所有男生的姓名,课程名及该课的成绩selectsname,cname,gradefromstudent,sc,coursewherestudent.sno=sc.snoando=oandcname='数据库'andsex='男'andsdept='计算机系'3005查询09级选修了数据库课的最高成绩.最低成绩和平均成绩(注用as来表示最低,最高及平均成绩selectmax(grade)as'最高成绩',min(grade)as'最低成绩',avg(grade)as'平均成绩'fromsc,coursewhereo=oandcname='数据库'andsnolike'09%'3006查询李勇同学选修的成绩在80分以上的课程的学分总和selectsum(ccredit)as学分总合fromstudent,sc,coursewherestudent.sno=sc.snoando=oandgrade>80andsname='李勇'3007查询09级末2位学号在15之前的选修过的课程中含有学分为4个学分课程的计算机系,男同学的姓名,课程名,学分。selectsname,cname,ccreditfromstudent,sc,coursewherestudent.sno=sc.snoando=oandstudent.snolike'09%'andright(student.sno,2)<15andccredit=4andsdept='计算机系'andsex='男'3008查询计算机系所有选了数据库成绩在80分以上的同学的姓名及成绩selectsname,gradefromstudent,sc,coursewherestudent.sno=sc.snoando=oandcname='数据库'andsdept='计算机系'andgrade>803009查询李勇同学所学课程的学分为2学分以上课程的学分总和及成绩总和(注用as总学分)selectsum(ccredit)as总学分,sum(grade)fromstudent,sc,coursewherestudent.sno=sc.snoando=oandsname='李勇'andccredit>23010查寻选了1号课,计算机系,男生的人数.selectcount(*)as人数fromstudent,scwherestudent.sno=sc.snoandcno='1'andsdept='计算机系'andsex='女';4001查询同时选修了1号课和3号课的同学的姓名及系selectsname,sdeptfromstudentwheresnoin(selectsnofromscwheresnoin(selectsnofromscwherecno='1')andcno='3')4002查询同时选修了数据库及数学的同学的姓名selectsnamefromstudentwheresnoin(selectsnofromscwheresnoin(selectsnofromscwherecnoin(selectcnofromcoursewherecname='数据库'))andcnoin(selectcnofromcoursewherecname='数学'))4003查询选修了全部课程的同学的姓名selectsnamefromstudentwheresnoin(selectsnofromscgroupbysnohavingcount(*)=(selectcount(*)fromcourse))4004查询与李勇同在一个系,且年龄比他小的同学的姓名(提示用year(csrq)来进行比较)selectsnamefromstudentwheresdeptin(selectsdeptfromstudentwheresname='李勇')andyear(csrq)>(selectyear(csrq)fromstudentwheresname='李勇')4005查询比计算机系平均年龄都大的其它系学生姓名,系和年龄。(注意不含计算机系的学生)提示设当前年为2010,平均年龄可用avg(2010-year(csrq))表示selectsname,sdept,(2010-year(csrq))as年龄fromstudentwhere(2010-year(csrq))>all(selectavg(2010-year(csrq))fromstudentwheresdept='计算机系')andsdept<>'计算机系'4006王名同学没有选过的课程名字selectcnamefromcoursewherecnonotin(SELECTcnoFROMSCwheresnoin(selectsnofromstudentwheresname='王名'))4007查询一门课也没选过的学生或选过课但平均成绩不及格(<60)的同学名单selectsnamefromstudentwheresnonotin(selectsnofromsc)orsnoin(selectsnofromscgroupbysnohavingavg(grade)<60)4008查询选修的学分总数超过8个的学生的姓名selectsnamefromstudentwheresnoin(selectsnofromsc,coursewhereo=ogroupbysnohavingsum(ccredit)>8)4009查询选修了和王名一样学分数的其它同学姓名selectsnamefromstudentwheresnoin(selectsnofromsc,coursewhereo=ogroupbysnohavingsum(ccredit)=(selectsum(ccredit)fromsc,coursewhereo=oandsnoin(selectsnofromstudentwheresname='王名'))andsname<>'王名')4010查询比平均成绩比李勇的平均成绩低的同学姓名selectsnamefromstudentwheresnoin(selectsnofromscgroupbysnohavingavg(grade)<(selectavg(grade)fromscwheresnoin(selectsnofromstudentwheresname='李勇')))6001用定义语句建立一个“学生”表student1,要求它的结构与student表的结构相同,并且规定名字不得为空,学号设为唯一(unique)createtablestudent1(snochar(8)unique,snamechar(8)notnull,sexchar(2),sdeptchar(20),csrqdate);6002用定义语句创建选课表要sc1,要求和sc表一样,学号与课程号不得为空(成绩类型用float)createtablesc1(snochar(8)notnull,cnochar(3)notnull,gradefloat)6003在学生表Student1中增加系(sageint)一列,缺省值为20(缺省defaultNN)altertablestudent1addsageintdefault20;6004将学生表Student1学生所属系(sdept)长度改为50,约束条件为不为空altertablestudentaltersdeptchar(50)notnull;;(C++,modify改为alter)6005创建一个名字为v_stu视图,视图字段为sno,sname,gradecreateviewv_stuasselectstudent.sno,sname,gradefromstudent,scwherestudent.sno=sc.sno6006删除视图文件v_studroptablev_stu6007请将学生表student1中的年龄sage字段删除altertablestudent1dropsage6008以cno做主索引列(降序),grade做第二索引列(升序),对sc建索引文件,取名为idx_sccreateindexidx_sconsc(cnodesc,grade)6009删除索引文件idx_scdropindexidx_sc//onstudent(C++下)dropindexidx_sconsc16010删除sc1表droptablesc17002以student文传系的1987年前出生的女生信息插入到student1表中insertintostudent1select*fromstudentwheresdept='文传系'andsex='女'andyear(csrq)<19877003将1990年后的所有徐姓学生记录从student表插入到student1中insertintostudent1select*fromstudentwhereyear(csrq)>=1990andsnamelike'徐%'7001将一个新同学的记录(sno:07010150;sname:陈冬;sex:男;sdept:信息;csrq:1985-6-8)插入到STUDENT1表中。Insertintostudent1values('07010150','陈冬','男','信息','1985-6-8')7005请将student1表中魏玲铃
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度汽车租赁与智能交通系统对接合同3篇
- 2025-2030全球全自动农业机器人行业调研及趋势分析报告
- 2024年全国数控技能大赛理论考试题库-上(单选题) (二)
- 2025年度钢管架施工设备租赁合同样本
- 2025年度个人反担保合同纠纷解决协议
- 2025年度数字电视信号接收器采购合同4篇
- 2025版施工合同担保人资质审核及责任规范3篇
- 教育者与科技联手强化校园安全措施
- 2025年度商铺物业管理与商业策略规划合同4篇
- 二零二五年度茶馆社区服务合作协议4篇
- 定额〔2025〕1号文-关于发布2018版电力建设工程概预算定额2024年度价格水平调整的通知
- 2024年城市轨道交通设备维保及安全检查合同3篇
- 电力沟施工组织设计-电缆沟
- 单位往个人转账的合同(2篇)
- 科研伦理审查与违规处理考核试卷
- GB/T 44101-2024中国式摔跤课程学生运动能力测评规范
- 锅炉本体安装单位工程验收表格
- 一种基于STM32的智能门锁系统的设计-毕业论文
- 高危妊娠的评估和护理
- 妊娠合并强直性脊柱炎的护理查房
- 2024年山东铁投集团招聘笔试参考题库含答案解析
评论
0/150
提交评论