SQL JOINS

user table

course table

THE INNER JOIN

produces a set of records which match in both the user and course tables, i.e. all users who are enrolled on a course:

 

AN ASIDE (THE WHERE CLAUSE == INNER JOIN ??)

any table you can produce with an inner join can be produced by a where clause ( but WHERE !== INNER JOIN re: type coercion)

THE LEFT JOIN

produces a set of records that matches every entry in the left table (user) regardless of any matching entry in the right table (course)

THE RIGHT JOIN

produces a set of records that matches every entry in the right table (course) regardless of any matching entry in the left table (user):

a              b 

a               b 

SQL

By ayana28

SQL

  • 1,357