准备工作:
1 | create table student( |
1、查询“c001”课程比“c002”课程成绩高的所有学生的成绩信息;
1 | SQL> select a.* from |
或者:
1 | SQL> select * from sc a |
2、查询平均成绩大于60分的同学的学号和平均成绩;
1 | SQL> select sno,avg(score) from sc group by sno having avg(score) > 60; |
3、查询所有同学的学号、姓名、选课数、总成绩;
1 | SQL> SELECT a.sno, a.sNAME,sum(score),count(b.cno) |
4、查询姓“刘”的老师的个数:
1 | SQL> select count(1) from TEACHER where TNAME LIKE '刘%'; |