Example of SQL Outer Join

·

Student (sno: integer, stname: string, major: string, level: string, age: integer)
Class (name: string, meets_at: string, room: string, fid: integer)
Enrolled (sno: integer, cname: string)
Faculty (fid: integer, fname: string, deptid: integer)


Find the names of all students and the names of all classes they are enrolled in (if any)

SELECT S.stname, E.cname
FROM Student S LEFT JOIN Enrolled E ON S.sno = E.sno

Live Traffic Feed

About this blog

Site Sponsors