Sub-query
Where Can Sub-query be placed in?
After WHERE
sql
SELECT * FROM [table]
WHERE [column] [operator] [sub_query]
1
2
2
In SELECT
Statement
sql
SELECT
[column1],
[column2],
(SELECT [column]
FROM [table]) AS [alias]
FROM [table]
1
2
3
4
5
6
2
3
4
5
6
After FROM
sql
SELECT *
FROM [sub_query]
1
2
2
- Use view to represent temporary table when the sub-query is complex.