SQL Group By: An Explanation and How To Use It

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

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

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

    Want to easily remember the SQL commands for your database? Get my free SQL Cheat Sheets here: databasestar.mykajabi.com/lpkj-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

  • @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!

  • @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.

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

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

  • @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.

  • @rjjalaparthi545
    @rjjalaparthi545 4 месяца назад +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 10 месяцев назад +1

    your explanations resonates with me on a deep level.

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

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

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

    you are definitely a database star. Thank you

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

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

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

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

    • @DatabaseStar
      @DatabaseStar  7 месяцев назад +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 7 месяцев назад

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

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

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

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

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

  • @aciv132
    @aciv132 2 месяца назад +1

    10/10 explanation. Very simple.

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

      Thanks, glad you found it helpful!

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

    Thanks for actually explaining it.

  • @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...

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

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

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

    Great explanation 💯🤍🤍🤍

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

    that waaaaas veeeeery helpful thaaaaaank you

  • @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?

  • @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😅😅

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

    awesome most easiest explanation. Thanks man

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

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

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

      Good idea, I can do that.

  • @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.

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

    Thank you for this very useful video!

  • @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"?

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

    very detailed. clear. beautiful
    thanks ALOT
    really helpful

  • @bot299i82
    @bot299i82 8 месяцев назад +27

    😂 nobody understand group by

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

      It can be hard to understand

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

    Excellent video !

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

    real good video, thank you!

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

    very helpful; thank you!

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

    Thank you very much

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

    Very good information

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

    thanks it really helped

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

    Thank you 👍

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

    Thanks for that.

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

    thank you.

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

    thax

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

    I honestly gonna die with this language :")

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

    Thanks

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

    Can you t sql vedios

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

    🙌