SUBQUERIES SQL
-These are the SQL Statements which are embedded inside another SQL Statements.
Example:-
--1)To find the details of the person who earns the maximum salary or 3rd highest salary we have to use the subquery.
1. Subquery is always written in parentheses.
2.Subquery evaluates a particular data which can then be used as the input to the main query.
3.Subquery evaluates first.
4. Subqueries can be nested.
---Types of Subqueries:--
--1)Single row Subqueries
--2)Multiple row Subqueries.
---3)Subqueries using the exists operator:
---Single row Subqueries:--
---Only 1 row is returned by the subquery.
--Multiple row Subqueries:-
--More than 1 row is returned by the subquery.
--An error message will be generated which can then be resolved using the in operator.
--Exists operator subquery:-
---The subquery will just return true or false
--values to the main query on the basis of which
--the main query will execute.
Example:-
--1)To find the details of the person who earns the maximum salary or 3rd highest salary we have to use the subquery.
1. Subquery is always written in parentheses.
2.Subquery evaluates a particular data which can then be used as the input to the main query.
3.Subquery evaluates first.
4. Subqueries can be nested.
---Types of Subqueries:--
--1)Single row Subqueries
--2)Multiple row Subqueries.
---3)Subqueries using the exists operator:
---Single row Subqueries:--
---Only 1 row is returned by the subquery.
--Multiple row Subqueries:-
--More than 1 row is returned by the subquery.
--An error message will be generated which can then be resolved using the in operator.
--Exists operator subquery:-
---The subquery will just return true or false
--values to the main query on the basis of which
--the main query will execute.
SUBQUERIES SQL
Reviewed by Rupesh
on
13:09
Rating:
No comments: