create table SC(CNO NUMBER,SNO NUMBER,GRADE NUMBER)
create table STUDENT(SNO int not null,SNAME VARCHAR2(40),SAGE int,SSEX VARCHAR2(10))
create table COURSE(CNO NUMBER,CNAME VARCHAR2(40),CPNO NUMBER,CCREDIT NUMBER,TEACHER VARCHAR2(20))
统计每门课程选修的人数
select count(*) from SC
查询至少选修‘陈东’老师的一门课程的女生
select SNAME from STUDENT where SSEX = '女' and SNO in (select select SNUMBER form SC where CNUMBER in (select NUMBER from COURSE where TEACHER='陈东'))
求‘陈东’老师所教授的每门课程的平均成绩和总人数
select count(sc.cno),avg(grade) from SC,c where cno=="chen" and sc.cno == c.cno group by cno
select avg(grade) from SC wheren CNO in (select )group by CNO
统计每门课程的学生人数(要求超过2人才统计)要求输出课程号和选修人数,结果按照人数的降序排序,人数相同的话按照课程号升序排序
select count(sc.sno) as 'xuanxiurenshu', cno from sc group by cno having count(sno)>2 order by 2.desc,1
找出年纪大于女生平均年纪的男生
select sname from s where sex == "nan" and age > (select avg(age) from s where sex='nv')
找出在SC表没有成绩,但是在Student中存在的学生
select * from s where sno in (select sno from sc where grade is null)
查询选修总学分在10学分以下的学生姓名
select sname from c , s where
create table STUDENT(SNO int not null,SNAME VARCHAR2(40),SAGE int,SSEX VARCHAR2(10))
create table COURSE(CNO NUMBER,CNAME VARCHAR2(40),CPNO NUMBER,CCREDIT NUMBER,TEACHER VARCHAR2(20))
统计每门课程选修的人数
select count(*) from SC
查询至少选修‘陈东’老师的一门课程的女生
select SNAME from STUDENT where SSEX = '女' and SNO in (select select SNUMBER form SC where CNUMBER in (select NUMBER from COURSE where TEACHER='陈东'))
求‘陈东’老师所教授的每门课程的平均成绩和总人数
select count(sc.cno),avg(grade) from SC,c where cno=="chen" and sc.cno == c.cno group by cno
select avg(grade) from SC wheren CNO in (select )group by CNO
统计每门课程的学生人数(要求超过2人才统计)要求输出课程号和选修人数,结果按照人数的降序排序,人数相同的话按照课程号升序排序
select count(sc.sno) as 'xuanxiurenshu', cno from sc group by cno having count(sno)>2 order by 2.desc,1
找出年纪大于女生平均年纪的男生
select sname from s where sex == "nan" and age > (select avg(age) from s where sex='nv')
找出在SC表没有成绩,但是在Student中存在的学生
select * from s where sno in (select sno from sc where grade is null)
查询选修总学分在10学分以下的学生姓名
select sname from c , s where