Subscriber only lesson.
Sign up to this course to view this lesson.
A Subquery is a Query inside of another Query.
When to use
Use them whenever you need to run more than one select statement at a time.
Subqueries are made of inner queries and outer queries. Simply wrap your outer query (the 2nd select statement) in parenthesis (), and then paste it into your first query.
SELECT [First Name], [Last Name]
WHERE [Customer ID] IN (SELECT [CUSTOMER ID]
WHERE [CUSTOMER ID] > 4)
Hints & tips
- A Subquery is a Query inside of another Query.
- Subqueries can go inside select statements, and where statements and all kinds of places.
Lesson notes are only available for subscribers.