A subquery is a nested select statement where the inner select statement is evaluated first. You can use the results of the inner select statement as the input for another select statement.
For example, you can use the results of a subquery as a search condition that uses the
IN ( ) function or EXISTS operator:
USE pubs
SELECT * FROM authors WHERE au_id
NOT IN (SELECT au_id FROM titleauthor)