NOTE: introduce you to the derived table concept and show you how to use it to simplify complex queries.
Introduction to MySQL derived tables
A derived table is a virtual table returned from a SELECT
statement. A derived table is similar to a temporary table, but using a derived table in the SELECT
statement is much simpler than a temporary table because it does not require creating a temporary table.
The term derived table and subquery is often used interchangeably. When a stand-alone subquery is used in the FROM
clause of a SELECT
statement, it is also called a derived table.
The following illustrates a query that uses a derived table:

Basic MySQL Derived Table example
The following query gets the top five products by sales revenue in 2003 from the orders
and orderdetails
tables in the sample database:
