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

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;

 

 

 

posted @ 2016-10-12 08:16  熊猫卡洛斯  阅读(233)  评论(0编辑  收藏  举报