Over here at EssentialSQL I’ve written many articles about subqueries.
Subqueries are versatile and I want to make sure you’re able to use them! Of course, its that versatility which make them so baffling at times.
Did you know you can use a subquery just about anywhere in your SELECT statement? I think that is what makes them so confusing.
To help with this I’ve put together a good article I want you to read Introduction to Subqueries.
In this article I cover how subqueries work, where you can use them, and some tricks you can use to make your queries less “hard coded” and more robust.
I think one think that makes subqueries so confusing is they can either a single or multiple result. And because of this, you need to know where you can use them! For instance, subqueries returning multiple rows in SELECT clause will fail!
To learn about this important distinction, check out these two popular articles: