ab-logo

Code. Models. Analysis. Decisions.


Join Data From Multiple Tables in MySQL

INNER and OUTER JOINS in MySQL

Much of the power of SQL and MySQL lies in the ability to recombine data from multiple tables into a single temporary table. This is accomplished with the JOIN clause which is actually considered part of the WHERE clause.

Joins can be either equi or INNER JOINS, meaning you only see results where there is a foreign key that corresponds to a specific primary key, or they can be OUTER joins - you see all primary keys in the result as well as those with corresponding foreign keys. OUTER joins are often used to show instances where something has NOT occured, for example customers who have not placed orders.

The video tutorial below shows examples of several alternative syntactic structures for joins with examples of INNER JOINS and OUTER JOINS.

You may also be interested in:

Basic MySQL Queries

Creating Databases and Loading Data

Using MySQL Text Functions

Statistics with MySQL

IF, CASE WHEN THEN


You can download the data and code .