Account
Categories

Subquery


A subquery is called a nested query because it is a query inside another.
It filters data from the database by determining which data belongs to whom.
Subqueries help perform calculations within a query and solve complex problems.

Syntax:

SELECT column_name
FROM table_name
WHERE column_name operator (
SELECT column_name
FROM another_table
WHERE condition
);

Example:



Output: