Aside from the basic differences involved with using subqueries, there are a few additional facts we should remember. We take a look at these rules in this section.
A subquery is a query that is nested within another query. However, subqueries can also be nested inside other subqueries. Multiple nested subqueries allow us to use queries from more than two tables, although they can also be used with a single table. An example of this is shown in the following screenshot with indentation and line separation to make the different queries more distinct:
Here, we have three distinct queries—one from the blog table, one from the website table, and one from, employee. The innermost query selects the average of the hit_count
column from blog and passes it back to the second level query. That query returns employee_id
values that have a hit_count
in website that are greater than the average hit_count
in blog. The outermost query displays...