A QUERY WITHIN THE QUERY you can say as a sub Query. In this post, for your benefit, I am sharing ideas on how to write it quickly.
Basically, the main query needs some value from a sub Query. So your inner query should be in a position to supply a value.
Select employee_name from employee where dept_no in (100,200);
From the above query, you can understand that the values in the brackets act as a sub Query. Really simple.
Also You May Like: Top Rules You Need to Write a Sub Query
Now the important idea is a sub query should supply a list of values.
SUB Query in SELECT statement
where dept_no in (
You can find here, the idea we already learned. The inner select supplies list of department numbers. For example 100, 200, 300, 400 etc.
That is all. Now you can write any sub query quickly.