电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

SQL语句练习及答案VIP免费

SQL语句练习及答案_第1页
1/14
SQL语句练习及答案_第2页
2/14
SQL语句练习及答案_第3页
3/14
现在有一教学管理系统,具体的关系模式如下: Stu dent (no, name, sex , birthday , class) Teacher (no, name, sex , birthday , prof, depart) Cou rse (cno, cname, tno) Score (no, cno, degree) 其中表中包含如下数据: Cou rse表: Score 表: Stu dent 表: Teacher 表: 根据上面描述完成下面问题: (注意:注意保存脚本,尤其是DDL和DML,以便进行数据还原) DDL 1. 写出上述表的建表语句。 命令:create table Stu dent (no nv archar(5), name nv archar(5), sex nv archar(1), birthday datetime, class nv archar(5) ) DML 2. 给出相应的INSERT语句来完成题中给出数据的插入。 命令: 单表查询 3. 以class 降序输出stu dent 的所有记录(stu dent 表全部属性) 命令:select * from Stu dent order by class desc 4. 列出教师所在的单位depart(不重复)。 命令:select distinct depart from teacher 5. 列出stu dent 表中所有记录的name、sex 和 class 列 命令:select name,sex ,class from stu dent 6. 输出student 中不姓王的同学的姓名。 命令:select name from Student w here name not like '王%' 7. 输出成绩为 85 或 86 或 88 或在 60-80 之间的记录(no,cno,degree) 命令:select * from Score w here degree=85 or degree=86 or degree=88 or degree betw een 60 and 80 8. 输出班级为95001 或性别为‘女’ 的同学(student 表全部属性) 命令:select * from Student where class='95001' or sex='女' 9. 以 cno 升序、degree 降序输出score 的所有记录。(score 表全部属性) 命令:select * from Score order by cno,degree desc 10. 输出男生人数及这些男生分布在多少个班级中 命令:select COUNT(*),COUNT(distinct class) from Student where sex='男' 11. 列出存在有85分以上成绩的课程编号。 命令:select distinct cno from Score where degree>85 12. 输出95001 班级的学生人数 命令:select COUNT(*) from Student where class='95001' 13. 输出‘3-105’号课程的平均分 命令:select AVG(DEGREE) from Score where cno='3-105' 14. 输出student 中最大和最小的birthday日期值 命...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

SQL语句练习及答案

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部