Sub Query

A Sub-Query, as name suggested is a query within a query. Outer query is result depends upon the result of the inner query.

SELECT Firstname, lastname, state

FROM table1

WHERE  countryid IN

(SELECT countryid FROM country WHERE id=5)

 

Inner query must be processed first so the result set can be passed to the outer query.

Leave a Reply