Introduction to subqueries

A relational database allows you to store related data in more than one table. In addition to being able to extract data from related tables using a join, you can also extract it using a subquery. A subquery is a SELECT statement nested within the SELECT, WHERE, or HAVING clause of a parent SQL statement.

Subqueries make some queries easier to write than joins, and there are queries that cannot be written without using subqueries.


Categorization of subqueries
Using subqueries instead of joins