0% found this document useful (0 votes)
4 views

SQL_subquery

A subquery is a SQL query nested within another query, typically found in the WHERE clause of SELECT, INSERT, UPDATE, or DELETE statements. It executes before the outer query, allowing its results to be utilized by the parent query. Subqueries can be used for comparisons, checking inclusion in results, or verifying if any rows are selected.

Uploaded by

2305514
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

SQL_subquery

A subquery is a SQL query nested within another query, typically found in the WHERE clause of SELECT, INSERT, UPDATE, or DELETE statements. It executes before the outer query, allowing its results to be utilized by the parent query. Subqueries can be used for comparisons, checking inclusion in results, or verifying if any rows are selected.

Uploaded by

2305514
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

SQL Sub-query

 A subquery is a SQL query nested inside a larger query.

 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 =. The comparison operator can also be a multiple-
row operator, such as IN, ANY, or ALL.

 A subquery is also called an inner query or inner select, while the statement containing a subquery is also
called an outer query or outer select.

 The inner query executes first before its parent query so that the results of an inner query can be passed
to the outer query.
You can use a subquery in a SELECT, INSERT, DELETE, or UPDATE statement to perform
the following tasks:

 Compare an expression to the result of the query.


 Determine if an expression is included in the results of the query.
 Check whether the query selects any rows.
END

You might also like