-2

我正在尝试实现我认为是 Oracle 中四个表的内部联接。这是场景:

表:

Course
Course_ID | Title

Course_Offering
Offering_ID | Location | Course_ID

Attendance
Student_ID | Offering_ID 

Student
Student_ID | Name | Number etc.

我正在尝试编写一个查询,该查询将仅显示学生参加过的课程的student_name标题。学生可以参加存储在Attendance表中的课程的许多课程。我将如何实现这一目标?

4

1 回答 1

2
select s.student, c.title
from student s, attendance a, course_offering co, course c
where s.student_id  = a.student_id
and   a.offering_id = co.offering_id
and   co.course_id  = c.course_id
and   s.student_id = "insert id here";

This will give you what you are looking for as long as you know the student's ID.

于 2013-03-25T18:01:05.067 回答