基本的SQ语句练习.docVIP

  1. 1、本文档共4页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  5. 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  6. 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  7. 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  8. 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
基本的SQ语句练习

Sno Sname Ssex Sage Sdept 2000012 王林 男 19 计算机 2000113 张大民 男 18 管理 2000256 顾芳 女 19 管理 2000278 姜凡 男 19 管理 2000014 葛波 女 18 计算机 2000011 李刚 男 22 计算机 根据下面三个关系模式完成下面习题:答案已设为白色 需要就全选设为黑色 学生表Student 课程表Course Cno Cname Cpno Ccredit 1024 数据库原理 1136 4 1136 离散数学 1128 4 1137 管理学 ? 4 1156 英语 ? 6 1128 高等数学 6 1111 体育 3 学生选课表SC Sno Cno Grade 2000012 1156 80 2000113 1156 89 2000256 1156 93 2000014 1156 88 2000256 1137 77 2000278 1137 89 2000012 1024 80 2000014 1136 90 2000012 1136 78 2000012 1137 70 2000014 1024 88 成绩类别表 type Lowest_grade Highest_grade 优秀 85 100 良 75 84 及格 60 74 不及格 0 59 第一章课件:编写基本的SQL语句。 查询所有学生情况。 Select * from student; select * from student; 查询所有学生的姓名,性别以及年龄。 Select sname,ssex,sage from student; select Sname,Sage,Ssex from student; 查询所有学生10年后的年龄。 Select sage+10 10年后 from student; 查询所有课程(列名用中文显示)。 Select cname 课程名 from course; 查看竟有那些学生选课(重复学号显示一次)。 Select distinct sno from course where cno is not null; 显示课程表的边结构。 Desc course; 第二章课件:约束和排序数据。 01.查询计算机系的所有学生的姓名和年龄。 Select sname,sage from student where sdept =’计算机’; 02.查询体育课的学分。 Select ccredit from course where cname=’体育’; 03.查询年龄小于18的学生。 Select * from student where sage 18; 04.查询年龄大于20的学生。 Select * from student where sage 20; 05.查询年龄介于18和20之间的学生(包括18和20)。 Select * from student where sage between 18 and 20; 06.查询年龄不在18和20之间的学生。 Select * from student where sage not between 18 and 20 07.查询年龄为18,20,22的学生。 Select * from student where sage in (18,20,22); 08.查询年龄不是18,20,22的学生。 Select * from student where sage not in (18,20,22); 09.查询所有姓张的学生。 Select * from student where sname like ‘张%’ 10.查询所有没有先行课的课程。 Select cname from course where cpno is null; 11.查询有先行课的课程。 Select cname from course where cpno is not null; 12.在计算机系中找,姓张的男生。 Select * from student where sname like ‘张%’ and cdept=’计算机’ 13.在计算机系中找,姓张的或者姓李的男生并且按照年龄从大到小排序。 Select sname,ssex,sage,sdept from student where sname like 张% or sname like 李% order by sage desc ;Select * from stident order by sdept desc ,sage desc;

文档评论(0)

ctuorn0371 + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档