数据库练习解答--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;

 

 

 

转载于:https://www.cnblogs.com/tfl-511/p/5951441.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值