From the course: Learning SQL Programming

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Understand JOIN types

Understand JOIN types - SQL Tutorial

From the course: Learning SQL Programming

Start my 1-month free trial

Understand JOIN types

- [Instructor] When we use a join to associate data across tables, there are a few ways we can go about it. Let's think about our two tables as being on the left and the right in some kind of imaginary workspace. Left and right in this sense are the table named first in the select statement on the left and the table we're joining to on the right. If we just leave a statement without any kind of qualifying parameters, we get a resulting table that's the size of the left table times the right table. We get back one of every row from the right table for every row of the left table. Notice how here in the result there's three results for Marcus and California, one associated with each of the entries from the states, and then when that's finished, there's three entries for Jennifer and Virginia, and so on. This was called a cross join, and we won't use it too much. When we ask to join tables based on some given criteria, that creates overlap between the tables where the criteria match. The…

Contents