IT lexicon › Database › Subquery

Subquery

Database På svenska → Updated: 2026-11-10

A SELECT statement embedded within another SELECT, UPDATE, or DELETE statement.

Subqueries let you use the result of one query as input to another. Example: SELECT * FROM orders WHERE customer_id IN (SELECT id FROM customers WHERE city='Stockholm'). Before JOIN became universal, subqueries were the primary way to correlate data from multiple tables. They're still useful for complex queries and lookups.

← Back to the lexicon