In this chapter, you will learn how to query multiple tables. You will learn how to use SQL joins to join two or more tables together, including INNER and OUTER (LEFT, RIGHT, and FULL) joins, and advanced joins (cross, natural, and self joins). You will learn about set theory and how to combine queries using UNION and UNION ALL, and how to get the differences and intersections of different queries. Lastly, you will learn how to optimize queries when they contain multiple tables.
In this chapter, we will cover the following topics:
- Understanding joins
- Using INNER JOIN
- Using OUTER JOIN
- Using advanced joins
- Understanding set theory
- Using indexes with your queries