Databases · Junior · Question 58 of 75
What is a subquery?
SELECT name FROM products
WHERE price > (SELECT AVG(price) FROM products);- 1A query saved as a view
- ✓Correct answer: A query inside another query; here it finds products more expensive than average
- 3A query that runs on a replica
Explanation
Subqueries can return one value (as here), a list for IN, or a whole table in FROM. CTEs (WITH) are often a more readable way to write them.