Answer:
Required code present in image attached
Step-by-step explanation:
At first, the subquery (i.e., the inner query) will execute one time before executing the main query (i.e., outer query). This sequence is important since the result from the subquery is being utilized for when the main query executes to produced the desired outcome. The final result will be obtained after the last line of code executes.