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.
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework