Перейти к содержимому

SQL #10 — Subqueries Explained — Scalar, Correlated, EXISTS & IN

hosiyar

0:00 / 0:00

SQL #10 — Subqueries Explained — Scalar, Correlated, EXISTS & IN

557 просмотров · 4 нед. назад
hosiyar
885 подписчиков
557 просмотров · 4 нед. назад
What if you could use the result of one query inside another query? That's exactly what a subquery is — a query nested inside a bigger query. And once you understand them, SQL problems that felt impossible suddenly become straightforward. In this lesson, we go through every type of subquery you'll actually use. We start with the simplest kind — scalar subqueries that return a single value — and build up to correlated subqueries, which run once for every row. Then we cover EXISTS and the IN operator with subqueries, and solve real questions live to see how each type works in practice. What you'll learn: What a subquery is, and where it can appear in a query Scalar subqueries — returning a single value (used in SELECT, WHERE, HAVING) Subqueries with IN — checking against a list from another query Correlated subqueries — a subquery that depends on the outer query's row EXISTS — checking whether matching rows exist, without fetching them Live-solved examples for each type When to use a subquery vs a JOIN Subqueries are one of those topics that sound harder than they are. Take it one type at a time and you'll be fine. We use the same practice database from lesson #01. 📁 Practice SQL file & resources: https://github.com/deep473/hosiyar-re... This is lesson #10 of the full "SQL Zero to Advanced" course. If you've followed along from #00, you now have enough SQL to handle most real-world problems. If you're jumping in here, watch at least #02–#05 and #07 (joins) first. 🔗 Full SQL course playlist:    • SQL Full Course — From Zero to Advanced, S...   #SQL #MySQL #SQLSubqueries #CorrelatedSubquery #SQLExists #SQLForBeginners #LearnSQL