Home > database >  ORACLE exercises for your guidance
ORACLE exercises for your guidance

Time:09-18

Students (STUDENT id, name, AGE, gender) STUDENT (SNO, SNAME, AGE and SEX)
Course selection (student id, class, GRADE) GRADE (SNO, CNO, SCORE)
Classes (class, class, TEACHER) COURSE (CNO, CNAME, the TEACHER)
Try to complete the following SQL query function:
1, retrieval Wang students don't study the course of the

2, retrieve all the students are optional course of course number and name

3, retrieval take less than three courses and not take LIU teacher taught course students name identification

CodePudding user response:

Not the original poster which subject?

CodePudding user response:

is a look at the teacher give the title of the ah, you don't how to write SQL data, and it is best to give you ideas and write their own

CodePudding user response:

1, select the cno from course where cno not in (select a.c no from grade a, student b where a.s no=b.s no and b.s name='wang')
2, the select cno, cname from course where cno in
(
The select a.c no from
(select cno, count (distinct sno) as amount2 from grade group by cno) a,
(select count (distinct sno) as amount1 from grade) b
Where a.a mount2=b.a mount1
)
3, select sname from student where sno in
(
The select a.s no from
(select sno, count (distinct cno) from grade group by sno having count (distinct cno) & lt; 3) a,
(select distinct sno from grade where cno not in (select cno from course where the teacher='liu'))
bWhere a.c no=biggest no
)

CodePudding user response:

The second problem is some difficulty
  • Related