实验四 简单查询(基本查询与条件查询)

  1. 查询成绩在90分及其以上的选课信息
  2. 查询职称为教授的教师的教师号、姓名和专业
  3. 查询专业是计算机和数学的学生信息
  4. 查询年龄在30-40(包括30和40)岁的教师的教师号、姓名和职称
  5. 查询课时不在30-40(包括30和40)课时的课程的课程号、课程名和课时
  6. 查询课程号为c4和c6的选课信息,包括学号、课程号和成绩。
  7. 查询年龄大于20的学生的学号、姓名和年龄, 结果列名为汉字
  8. 查询选修了课程的学生学号
  9. 查询不是计算机系或信息系学生
  10. 查询姓名长度至少是三个汉字且第三个汉字必须是“马”的学生
  11. 查询姓名中含有“然”的学生信息
  12. 查询选修't3'老师,成绩在80至90之间学生的信息
  13. 查询没有成绩的学生的学号和课程号
  14. 查询学号为s1的学生的课程的平均分
  15. 查询选课表sc中选课学生人数
  16. 查询选课表sc中每个学生的选课信息及每个学生的选课门数
  17. 查询选课表sc中选了1门以上课程的学生的选课信息及学生的选课门数(不包括1门)
  18. 查询学号为s1的学生的选课信息,按照成绩降序排序
  19. 查询从第三位学生开始的4位学生的信息
  20. 查询选课表sc中每门课程的课程号及选课人数,按照选课人数降序排列,并且显示前5行

select * from course;
select sno from student;
select * from sc
where score>=90;
select tno,tname,maj
where prof='教授';
select * from student
where maj='计算机' or maj='数学';
select tno,tname,prof from teacher
where age>=30 and age<=40;
select tno,tname,prof from teacher
where age<30 or age>40;
select sno,cno,score from sc
where (cno='c4' or cno='c6');
select sno 学号,sname 姓名,age 年龄 from student
where age>20;
select sno from sc
where score is null;
select * from student
where maj not in ('计算机','信息');
select sname from student
where sname like '__马%'
select * from student
where sname like '%然%';
select * from sc
where tno='t3' and (score>=80 and score<=90);
select sno,cno from sc
where score is null;
select avg(score) from sc
where sno='s1';
select count(distinct sno) from sc;
select sno,count(score) from sc
group by sno;
select sno,count(score) from sc
group by sno
having count(score)>1;
select * from sc
where sno='s1'
order by score desc;
select * from student
limit 2,4;
select cno,count(*) from sc
group by cno
order by count(*) DESC
limit 5;

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值