SQL Outer joins
- by dsquaredtech
Three tables courses,registration,students
columns in students
firstname,lastname,studentid,major,admitdate,graddate,gender,dob
columns in registration
courseid,studentid
columns in courses
coursenumber,coursename,credits
select statement I need to modify
select lastname as 'Last Name',sum(credits) as 'Credits Registered For' from students as s
inner join registration as r on s.studentid = r.studentid
inner join courses as c on c.coursenumber = c.courseid
group by last name;
the question on the lab is... Modify the previous query to show all students, even if they have not registered for a class. You should have 14 rows. Students who are not registered will show NULL in output.
I know this requires outer join of some sort but I'm not fully grasping these joins i've read multiple posts on here and other sites but can't seem figure it out.