Writing Outer Joins

So far, you've learned about inner joins and cross joins. Cross joins include all the combinations of rows in the tables. Inner joins include only rows where tables include common values. Outer joins include rows where the tables don't include common values.

Why do you need to find rows where tables fail to intersect? Here's a common problem: Find the worst performing customers to target them for a sales campaign.

The example that we will create will start by first developing the example using inner joins, and then modifying the example to use an outer join to see how they differ.

We're interested in customer information, so we'll display the names and total sales for each customer. I'll limit the output to the first five rows. ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second 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.