The subquery is a query within another query. The outer query is called as the main query, and the inner query is called subquery. The SubQuery is always executed first, and the result of the subquery is passed on to the main query.
The subquery is a SQL query within a query.
The subqueries are nested queries that provide data to the enclosing query.
The subqueries can return individual values or a list of records
The subqueries must be enclosed with parenthesis
Example:-
SELECT column_name
FROM table_name
WHERE column_name expression operator
( SELECT COLUMN_NAME from TABLE_NAME WHERE ... );
Select NAME, LOCATION, PHONE_NUMBER from DATABASE
WHERE ROLL_NO IN
(SELECT ROLL_NO from STUDENT where SECTION=’A’);
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
The subquery is a query within another query. The outer query is called as the main query, and the inner query is called subquery. The SubQuery is always executed first, and the result of the subquery is passed on to the main query.