How to do Subqueries in SQL with Examples

preview_player
Показать описание
Step-by-step tutorial shows you how to use SQL subqueries in your SELECT statement & FROM and WHERE clauses!

Queries:
1) A subquery in the SELECT statement: SELECT customerid, freight, (SELECT AVG(freight) FROM orders) FROM orders
2) A subquery in the FROM clause: SELECT shipcountry, AVG(num_orders) FROM (SELECT customerid, shipcountry, count(*) AS num_orders FROM orders GROUP BY 1,2) sub GROUP BY 1
3) A subquery in the WHERE clause: SELECT * FROM orders WHERE employeeid IN (SELECT employeeid FROM employees WHERE LOWER(firstname) LIKE '%b%')

Support the Channel:
Рекомендации по теме
Комментарии
Автор

Finally, a break through. Finally, someone who explains the use of sub queries well.

honeyclover
Автор

CANNOT EXPLAIN ENOUGH HOW MUCH YOU SAVED MY LIFE.

dabeast
Автор

The idea that a subquery in a FROM statement creates a table and starting the query process from there was a real lightbulb moment - thank you

kristiankelloway
Автор

This is really helpful; more so than my online course! I look forward to watching more of your videos. Thank you!

sarahemslie
Автор

Thank you for telling us that even when you first learned this it was complex, because holy cow! I cannot wrap my head around this. I can kind of grasp whats going on, but I think you know the confusion that goes through a noob's mind. Thank you for your tutorials! I plan on watching many more of your videos.

Aaron-ilpk
Автор

super helpful and you explain stuff in a way where you don't rush through it but also don't take ages on it.

dfgndfghdfghdfgh
Автор

Really great explanations. Easy to follow and perfect variety. Very much appreciate you posting these tutorials, they're beyond helpful. Thanks!

Peter-cxir
Автор

Spending my Christmas binge watching your SQL tutorials haha so helpful. Thank you!!!!

juliakristavilladiego
Автор

Great video man!
The best explanation of sub queries that I found!
This is helping me a lot because I'm starting with a course of T-SQL

cameronp
Автор

WOW! the way you explained that is like first doing a table to then going and making a query from that table was a breakthrough for my understanding of the concept. I really admire people who can transform concepts into more digestible material. Thanks

jorgehernandezdominguez
Автор

Absolutely amazing explanation and you give hope that you said it took you a while, now look at you.

kramoo
Автор

So easy to understand without broken English. Keep them coming!

AlexMar-r
Автор

Thank you for explaining it the way you did, it just clicked for me. Great stuff! Keep up the good videos.

goptefq
Автор

Great video! Thank you so much for bringing a clear explanation of this topic. I look forward to viewing your other videos.

mmoralls
Автор

Thanks for the tutorials, you have being of great help on this journey...Keep them coming

samuelopoku-acheampong
Автор

Just started a Business Systems Analyst entry level position that uses SQL everyday and this video has been so helpful! You explained it better than the corporate instructor, Khan Academy and my Udemy course! THANK YOU!!!!

kw
Автор

This was very helpful. It saved me a lot of time. I understood it the first viewing and was able to apply the concepts with ease and complete my homework on time. Thank you, you do an excellent job. I will come back for future questions in SQL.

jcopas
Автор

Simple and direct. Just what I was needed.

manaygun
Автор

great videos! Its soo much easier too understand when watching your tutorials! Please do more advanced videos with window functions etc.

andyn
Автор

A great, and much needed take on this subject.

davidcoley