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
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.