SQL Group By: An Explanation and How To Use It

Поделиться
HTML-код
  • Опубликовано: 20 дек 2024

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

  • @DatabaseStar
    @DatabaseStar  24 дня назад +1

    Want to easily remember the SQL commands for your database? Get my free SQL Cheat Sheets here: www.databasestar.com/get-sql-cheat-sheets/?

  • @goobygoobdisney
    @goobygoobdisney Год назад +51

    I don't usually comment on tutorial videos, but this video is so clear I just want you to know how helpful you are for beginners like me

  • @sebastianhernandez9631
    @sebastianhernandez9631 Год назад +4

    I'm preparing for DP-900 exam and I was having a hard time with the Group By statement and aggregate functions. This video has helped me understand it perfectly. Thanks! Subscribed.

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

      Thanks! I'm glad the video helped you understand it.

  • @diamondsandlipgloss
    @diamondsandlipgloss 6 месяцев назад +2

    1:18 why do we need the parenthesis around the asterisk in the SELECT FROM statement?

    • @DatabaseStar
      @DatabaseStar  6 месяцев назад +1

      Good question. It's because the word COUNT is a function, and functions need to have brackets at the end of the name so they can run.
      Inside the brackets for functions, we specify parameters, such as values or columns to be processed by the function.
      The COUNT function can count columns: for example, COUNT(first_name) counts the number of first_name values that are not NULL.
      The asterisk is a different parameter to the COUNT function, and it means "count the entire row". So, COUNT(*) means count the entire row.
      Hope that answers your question.

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

      @@DatabaseStar got it, SO VERY helpful
      i don't know how i'll remember all of this 🤦🏾‍♀️

  • @rickvazquez6578
    @rickvazquez6578 2 года назад +18

    Mate you clarified something for me, I was wondering why I always had to add every other column I had to group by :) plenty helpful keep up the great tutorials!😃

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

      Glad it helped you understand the concept further!

  • @rjjalaparthi545
    @rjjalaparthi545 3 месяца назад +1

    Clear cut explanation, i always had doubt why we need to group by column which we used in select statement when we use aggregate functions in select, now its so clear. Thanks for the help

  • @akanirokingsley3304
    @akanirokingsley3304 8 месяцев назад +1

    your explanations resonates with me on a deep level.

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

      This makes me happy. I’m glad the explanations help you!

  • @manojkumar-yc4xq
    @manojkumar-yc4xq 6 месяцев назад +2

    What a clean and easy way of explaining the fact. Thank you SIR.

  • @user-iv9sh9fc3c
    @user-iv9sh9fc3c 7 месяцев назад +2

    you are definitely a database star. Thank you

  • @ordinaryperson-my7qr
    @ordinaryperson-my7qr 2 года назад +3

    thanks sooooo much dude
    i NEVER wrapped my head around how this works
    now i am crystal clear :)

  • @aciv132
    @aciv132 25 дней назад +1

    10/10 explanation. Very simple.

    • @DatabaseStar
      @DatabaseStar  23 дня назад

      Thanks, glad you found it helpful!

  • @lexiwhitmore2197
    @lexiwhitmore2197 Год назад +2

    This was helpful and clear, thank you! I liked your group by question, because I tend to create a question like that when I'm struggling to formulate the correct query.

  • @khawar1690
    @khawar1690 8 месяцев назад +1

    Very well explained. Aggregated function was helpful to me. Thank you

  • @thebigcheese1153
    @thebigcheese1153 9 месяцев назад +1

    Thanks for actually explaining it.

  • @COOKINGBIRD
    @COOKINGBIRD Год назад +2

    Your SQL video was exactly what I needed. Thank you for explaining it so clearly. 😄🎬💻🔍

  • @bot299i82
    @bot299i82 6 месяцев назад +25

    😂 nobody understand group by

    • @DatabaseStar
      @DatabaseStar  6 месяцев назад +4

      It can be hard to understand

  • @aashutosh937
    @aashutosh937 2 года назад +2

    Thank you for explaining it in such a simple way :)

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

    Super helpful. First slide's visual really helped...

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

    Nice video! Your indentation hurts me, but thank you for this video; It is very well presented!

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

      Thanks! Do you prefer a different style of indentation for SQL code?

  • @DCh-ks6ug
    @DCh-ks6ug 10 месяцев назад +1

    that waaaaas veeeeery helpful thaaaaaank you

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

    awesome most easiest explanation. Thanks man

  • @Aliyaaugust
    @Aliyaaugust 6 месяцев назад

    Great explanation 💯🤍🤍🤍

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

    Good to know, most important part was that the field selected should be in the group by clause. THey completely left that out in class

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

      Glad you liked the video. Can’t believe they left that out of your class!

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

      @@DatabaseStar It was a very rushed class tbh. Teaching finished at the beginning of November so I'm self-studying for finals😅😅

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

    Thank you for this very useful video!

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

    very detailed. clear. beautiful
    thanks ALOT
    really helpful

  • @leonsant-jennings7417
    @leonsant-jennings7417 Год назад

    Cheers boss, I knew I had to use Group By but I didn't fully understand why.

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

    👋 Bravo!
    A very well-explained demo!

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

      Thanks!

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

      @@DatabaseStar....... You're very welcome!
      Can you please make a crash course about "MySQL for Advanced Data Analytics"?

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

    My only question is if you have 3 columns in the Select Statement with an aggregate function, for example, is it mandatory to always include all 3 columns in the group by clause? And if not, then how do we know which of the 3 columns must be included?

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

      Good question. Yes, it's mandatory to include all three columns in the Group By clause. If you don't, you'll get an error about columns in the Select not in the Group By (the exact error will depend on the database vendor).
      The only exception is some versions of MySQL allow you to have a mismatch between the Group By and the Select. But you'll get a result that won't be correct, such as showing the first group only but the aggregate function on all rows.

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

      @@DatabaseStar Thanks for the awesome reply! I just subscribed.

  • @arvindt553
    @arvindt553 10 месяцев назад

    Can you please give an example with two tables that have many to many relationships

    • @DatabaseStar
      @DatabaseStar  10 месяцев назад

      Good idea, I can do that.

  • @Mike-vj8do
    @Mike-vj8do Год назад

    real good video, thank you!

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

    very helpful; thank you!

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

    Excellent video !

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

    Very good information

  • @douaz6905
    @douaz6905 3 месяца назад

    Thank you very much

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

    thanks it really helped

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

    Thank you 👍

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

    Thanks for that.

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

    I honestly gonna die with this language :")

  • @夜逃雨
    @夜逃雨 9 месяцев назад

    thank you.

  • @hfghffggjngyh4754
    @hfghffggjngyh4754 4 месяца назад

    thax

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

    Thanks

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

    Can you t sql vedios

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

    🙌