We Learn SQL #12 | SQL Subqueries in FROM

Поділитися
Вставка
  • Опубліковано 17 жов 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/

КОМЕНТАРІ • 15

  • @granand
    @granand 2 роки тому +6

    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.

    • @frolilapume
      @frolilapume 2 роки тому

      It would be amazing to have the raw data

  • @stefanhaagedoorn3690
    @stefanhaagedoorn3690 3 роки тому +7

    Great video! Just that the music is a bit too loud compared to your voice.

  • @DimsUche
    @DimsUche Рік тому

    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

  • @frolilapume
    @frolilapume 2 роки тому

    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?

  • @feliksprzybyszewski4033
    @feliksprzybyszewski4033 3 роки тому

    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.

  • @Anass_076
    @Anass_076 5 місяців тому

    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.

  • @gotchihaeyo1825
    @gotchihaeyo1825 2 роки тому +2

    Please no music.
    But thanks for the video.

  • @lawngreenlyp
    @lawngreenlyp 3 роки тому

    Thanks. This is a very good example!

  • @luisgomez3109
    @luisgomez3109 3 роки тому +1

    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);

    • @feliksprzybyszewski4033
      @feliksprzybyszewski4033 3 роки тому +2

      Try this:
      SELECT MAX (COSTO_UNIT) FROM (
      SELECT AVG (VALOR_UNIT) AS COSTO_UNIT, PAIS_ORIG FROM DETALLEI
      GROUP BY PAIS_ORIG) as sub;

    • @luisgomez3109
      @luisgomez3109 3 роки тому +1

      @@feliksprzybyszewski4033 Hey it worked, thank you. I´m still learning. SQL has become very useful for me in my job.

  • @cv-if6wd
    @cv-if6wd 2 роки тому +1

    music is a bit distracting TBH. Thanks for the video.

  • @geofreykweyu6902
    @geofreykweyu6902 4 роки тому

    video number 10 missing or am I missing something

    • @welearnsql
      @welearnsql  4 роки тому

      Here it is: ua-cam.com/video/um3GXj_TB5U/v-deo.html