Chapter 5: Correlating Data across Tables
In this chapter, you will learn multiple ways to query data that is spread over more than one table. You will then use Common Table Expressions (CTEs) to build easy-to-follow queries where parts of the main query are abstracted out into separate parts. In addition, you will see how to work with a CTE to query for hierarchical data and generate ranges of numbers, dates, and more. Finally, you will learn how to use EXPLAIN
to see how MySQL would execute a query.
This chapter covers the following topics:
- Introduction to processing data across tables
- Joining two tables
- Analyzing subqueries
- Common table expressions
- Analyzing query performance with EXPLAIN
- Activity 5.01: The Sakila video store
- Activity 5.02: Generating a list of years