OUTER JOINs Versus INNER JOINs

Just as the non-equi-join balances the equi-join, an OUTER JOIN complements the INNER JOIN. An INNER JOIN is when the rows of the tables are combined with each other, producing a number of new rows equal to the product of the number of rows in each table. Also, the INNER JOIN uses these rows to determine the result of the WHERE clause. An OUTER JOIN groups the two tables in a slightly different way. An OUTER JOIN displays all rows of data from one table even though matching data might not reside in the joined table. For example, you might want to generate a list of all products and their prices, although some products might have no orders. Using the PARTS and ORDERS tables from the previous examples, perform the ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.