SQL Noob

eternaloptimist

Well-Known Member
Joined
Jul 10, 2013
Messages
175
Reaction score
1
Hey all, I'm wondering if my queries are wrong? I'm a noob and will appreciate any help I can get, thanks in advance.

Question


Code:
select courses.coursename, students.lastname from students
inner join courses on students.takingcourse = courses.coursecode
where students.lastname = "Murphy";

Relational Algebra
Code:
π coursename (σ( lastname = 'Murphy' (students ⨝ courses) ))


Answer
 
You are missing a third table - Student_Course_Link(StudentId, CourseCode) - that links students to the courses that they taking.
 
You are missing a third table - Student_Course_Link(StudentId, CourseCode) - that links students to the courses that they taking.

Yup, read up on Bridge entities and many to many relationships.
 
Top
Sign up to the MyBroadband newsletter
X