SQL Subquery
Transcript
SQL Subquery
<!doctype html> <html lang="en"> <head> <title>SQL Subquery </title> </head> <body> </body> </html>
What is SQL Sqbquery?
A subquery is a SQL query nested inside a larger query.
Where Subquery Occurs?
A subquery may occur in -
- A SELECT clause
- A FROM clause
- A WHERE clause
- The subquery can be nested inside a SELECT,INSERT,UPDATE,or DELETE statement or inside another subquery.
- A subquery is usually added within the WHERE Clause of another SQL SELECT statement.
- You can use the comparison operators, such as >, <, or =.
Subquery Syntax
- The subquery (inner query) executes before the main query (outer query).
- The result of the subquery is used by the main query.
Type of Subqueries
- Single row subquery : Returns zero or one row.
- Multiple row subquery : Returns one or more rows.
- Multiple column subquery : Returns one or more columns.
- Correlated subqueries : Reference one or more columns in the outer SQL statement.
- Nested subqueries : Subqueries are placed within another subqueries.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/slides/sql-subquery.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics