Subqueries give your queries more power and modularity. Instead of choosing a field or value, you can integrate a totally different query into your main (aka outer) query.
A subquery can be based on completely different tables or databases
In the video our main query was based on a view whereas our subquery was based on a completely different table.
First test your subquery before integrating it into your main query. Make sure your subquery outputs just one field.
The way you integrate a subquery is to surround it with Parentheses and give the output a name
#sql #subqueries #databases #queries