Это видео недоступно.
Сожалеем об этом.

We Learn SQL #10 | Subqueries with the IN operator in SQL

Поделиться
HTML-код
  • Опубликовано: 14 авг 2024
  • Learn SQL Subqueries with the IN operator. This is extremely helpful, thanks to which you will write better and clearer SQL queries.
    If you want to learn or practice SQL, check out learnsql.com/.
    Hello, my name is Adrian. Welcome to another video in the series about SQL basics. We already know simple subqueries that return a single value. We talked about them in the previous video. This time, we’re going to tackle slightly more advanced examples, where a subquery returns more than one value. So, without further ado, let’s get started!
    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/

Комментарии • 17

  • @deeplysuperficial8132
    @deeplysuperficial8132 2 года назад +11

    How do you not have more views and subscribers? Your explanation on subqueries is by far the best out of the 5 others I've watched.

  • @leecheeann493
    @leecheeann493 2 года назад +8

    I think the answer in 4:20 has one error.
    In the table *city*, we do not have column named 'city_id'.
    The correct one is
    SELECT * FROM city
    WHERE id IN (SELECT city_id FROM university WHERE rank

  • @patriciogaray2589
    @patriciogaray2589 2 года назад +5

    Muy buena explicación, solo un error en el código de
    "SELECT * FROM city WHERE city_id IN (...) ”
    Ya que la tabla city, no tiene la columna city_id, si no que la columna “id”, entonces la query correcta debiese ser:
    "SELECT * FROM city WHERE id IN (...);
    Propongo usar la convención de nombres para las T-SQL PascalCase.
    Muchas gracias por los videos! Son muy buenos. Exito en tu canal.

  • @suyashsrivastava3671
    @suyashsrivastava3671 3 года назад +6

    Last 2 queries can also be done using joins rt?

  • @arber10
    @arber10 3 года назад +4

    Very good explanation.
    The last example has a small flaw.
    ▶ "SELECT * FROM city WHERE city_id IN ..." instead of "... WHERE id IN ..."

    • @1970shikha
      @1970shikha Год назад

      Yes, this I too noticed and it should be rectified.
      But i must say 'explained very well'.

  • @ahmadfouad3786
    @ahmadfouad3786 2 года назад +6

    I think there is a mistake in the second query. It should be:
    Select *
    From city
    WHERE id IN
    (SELECT city_id FROM university WHERE rank

  • @Flyxes
    @Flyxes Год назад

    Low amount of views and such an extraordinary level of explanation, thank you!

  • @sogolsaremi6306
    @sogolsaremi6306 3 года назад

    Very helpful! Great work. I hope you keep working here and make more videos.

  • @geofreykweyu6902
    @geofreykweyu6902 4 года назад +1

    thanks really much

  • @ymnop9652
    @ymnop9652 2 года назад +1

    Shouldnt we use WHERE id(insted of city_id)? 4:23

  • @Maxpointgoldbuyersmeadowbrook
    @Maxpointgoldbuyersmeadowbrook 3 года назад

    great explanation! thank you

  • @helovesdata8483
    @helovesdata8483 2 года назад +1

    I guess the only challenge in the last query would be if we needed to show the actual rankings column for the output

  • @robertwide6592
    @robertwide6592 2 года назад

    thanks!

  • @IvanDerzhyloCIQ
    @IvanDerzhyloCIQ 8 месяцев назад

    is't better use distinct in subquery?
    `SELECT * FROM city WHERE id IN (SELECT DISTINCT city_id FROM university WHERE rank

  • @terb44
    @terb44 Год назад

    Is the "IN" operator just a better way of listing multiple results instead of using "OR" repeatedly?
    i.e. you could have just used
    WHERE
    country = "USA" OR "UK"

  • @milad12321
    @milad12321 5 месяцев назад

    The result in 2:12 only should have one column "ID". Learn yourself sql before teaching.