SQL Noob

eternaloptimist

Well-Known Member
Joined
Jul 10, 2013
Messages
175
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
 

rrh

Expert Member
Joined
Nov 29, 2005
Messages
4,031
You are missing a third table - Student_Course_Link(StudentId, CourseCode) - that links students to the courses that they taking.
 

HeftyCrab

Expert Member
Joined
Mar 26, 2009
Messages
2,292
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