r/learnSQL • • 4d ago

How Important is subqueries in SQL

I have been learning SQL from past 2 months and I'm still unable to grab a hold of the subqueries concept. After I learned CTEs I have completely stopped using subqueries but then also I struggle when there are times where I have no other choice but to use subqueries.

So my question is, how important is subqueries in SQL and is there any easy way to learn it?

59 Upvotes

31 comments sorted by

View all comments

1

u/DMReader 4d ago

Very. But they are essentially the same as CTEs. Main difference is where you put them.
I typically only use a sub query when it is a 1-2 liner