码迷,mamicode.com
首页 > 数据库 > 详细

数据库练习解答--1-8题解答

时间:2016-10-12 08:58:29      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:

1、 查询Student表中的所有记录的Sname、Ssex和Class列。

Select t.sname,t.ssex,t.sclass from student t;

技术分享

2、 查询教师所有的单位即不重复的Depart列。

Select * from teacher t where t.depart=‘计算机系‘;

技术分享

3、 查询Student表的所有记录。

Select *from student t;

技术分享

4、 查询Score表中成绩在60到80之间的所有记录。

Select * from student t where t.sno in (select e.sno from score e where degree between 60 and 80);

技术分享

5、 查询Score表中成绩为85,86或88的记录。

Select * from student t where t.sno in (select e.sno from score e where e.degree=‘85‘or e.degree=‘86‘or e.degree=‘88‘);

技术分享

6、 查询Student表中“95031”班或性别为“女”的同学记录。

Select * from student t where t.ssex=‘女‘or t.sclass=‘95031‘ ;

技术分享

7、 以Class降序查询Student表的所有记录。

select * from STUDENT t order by sclass;

技术分享

8、 以Cno升序、Degree降序查询Score表的所有记录。

select * from score t order by cno asc,degree desc;

技术分享

 

 

 

数据库练习解答--1-8题解答

标签:

原文地址:http://www.cnblogs.com/tfl-511/p/5951441.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!