We Learn SQL #12 | SQL Subqueries in FROM
HTML-код
- Опубликовано: 16 окт 2024
- Discover uses of SQL Subqueries in the FROM clause. Write better inquiries and work more efficiently.
If you want to learn or practice SQL, check out learnsql.com/.
Hi, I’m Adrian. This is a video in the series about SQL basics. In the previous videos, we learned a few types of SQL subqueries. Today, we’ll talk about another kind: SQL subqueries in the FROM clause.
Let’s learn SQL together!
👌 Subscribe to our channel and leave a comment!
👌 Do you want to learn SQL? Go to LearnSQL.com and choose the course or track that is best for you!
👌 Join us on Facebook: / welearnsql
🔊 Music: www.bensound.com/
Hi Adrian, Thank you a ton for this series. Greatly appreciated but please can you tone down the volume of the music and give us the raw data so we can practice along with you.
It would be amazing to have the raw data
Great video! Just that the music is a bit too loud compared to your voice.
Thank you for the explanation but please can you reduce the background sound in subsequent videos, it was overshadowing your voice and was quite distracting. Thanks again
Hey Adrian! Thanks for the tutorials. They have been very very helpful. Is there any way you can make these databases available for us to practice along?
Please no music.
But thanks for the video.
That was quite helpful, thank you so much, but would you mind turn off the background music, it's distracting, I can barely hear your voice.
Thanks. This is a very good example!
Hi, Taking the example table from this video, what would be the most efficient way (in MySQL) to get BOTH, max. national average value AND the countrt name it applies to?
It can be achieved with WHERE avg_rating = ( SELECT max (... ) but that would require another subquery, nearly the same as the first subquery that gets the AVG.
I tried implementing the following query but it won´t work.
It says something about missing an alias for subselect in the from clause.
SELECT MAX (COSTO_UNIT) FROM (
SELECT AVG (VALOR_UNIT) AS COSTO_UNIT, PAIS_ORIG FROM DETALLEI
GROUP BY PAIS_ORIG);
Try this:
SELECT MAX (COSTO_UNIT) FROM (
SELECT AVG (VALOR_UNIT) AS COSTO_UNIT, PAIS_ORIG FROM DETALLEI
GROUP BY PAIS_ORIG) as sub;
@@feliksprzybyszewski4033 Hey it worked, thank you. I´m still learning. SQL has become very useful for me in my job.
music is a bit distracting TBH. Thanks for the video.
video number 10 missing or am I missing something
Here it is: ruclips.net/video/um3GXj_TB5U/видео.html