For efficiently storing data, related information is often spread across multiple tables. Some queries for working with multiple tables:
Combines rows from different tables if the join condition is true.
SELECT * FROM table1 JOIN table2 ON table1.target_col = table2.target_col;
Joins can be:
discards unmatching rows between joined tables, or
Keep rows from first table whether or not there’s a matching row in second table.
which combines all rows of one table with all rows of another, and there’s
which basically stacks one dataset on top of another provided that:
Besides those, there’s the handy …
which allows for definition of one or more temporarry tables which can be used in a final query.
Also worth pointin out are:
which is a column that serves a unique identifier for the rows in the table, and
which is a column that contains the primary key to another table.