- 查询姓名不是以S, D, J开头的所有学生的学号和姓名。
select Sno, Sname from Student where Sname like '[^S,D,J]%';
- 查询选修课程超过2门课的学生的学号、平均成绩、选修门数。
select Sno, avg(Grade), count(Sno) from SC group by Sno having count(*)>2;
select Sno, Sname from Student where Sname like '[^S,D,J]%';
select Sno, avg(Grade), count(Sno) from SC group by Sno having count(*)>2;