A nested query, also known as a subquery, is a query written inside another SQL query. It is used when the output of one query is needed as input for another query.