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.
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.
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!😃
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
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.
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?
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.
Want to easily remember the SQL commands for your database? Get my free SQL Cheat Sheets here: www.databasestar.com/get-sql-cheat-sheets/?
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
Glad it was helpful!
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.
Thanks! I'm glad the video helped you understand it.
1:18 why do we need the parenthesis around the asterisk in the SELECT FROM statement?
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.
@@DatabaseStar got it, SO VERY helpful
i don't know how i'll remember all of this 🤦🏾♀️
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!😃
Glad it helped you understand the concept further!
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
Glad it was helpful!
your explanations resonates with me on a deep level.
This makes me happy. I’m glad the explanations help you!
What a clean and easy way of explaining the fact. Thank you SIR.
You're welcome!
you are definitely a database star. Thank you
Thanks!
thanks sooooo much dude
i NEVER wrapped my head around how this works
now i am crystal clear :)
Awesome, good to hear!
10/10 explanation. Very simple.
Thanks, glad you found it helpful!
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.
Glad it was helpful!
Very well explained. Aggregated function was helpful to me. Thank you
Glad it was helpful!
Thanks for actually explaining it.
You’re welcome!
Your SQL video was exactly what I needed. Thank you for explaining it so clearly. 😄🎬💻🔍
Thanks, glad you liked it!
😂 nobody understand group by
It can be hard to understand
Thank you for explaining it in such a simple way :)
You're very welcome!
Super helpful. First slide's visual really helped...
Glad you liked it!
Nice video! Your indentation hurts me, but thank you for this video; It is very well presented!
Thanks! Do you prefer a different style of indentation for SQL code?
that waaaaas veeeeery helpful thaaaaaank you
You're welcome!
awesome most easiest explanation. Thanks man
Glad it helped!
Great explanation 💯🤍🤍🤍
Thanks!
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
Glad you liked the video. Can’t believe they left that out of your class!
@@DatabaseStar It was a very rushed class tbh. Teaching finished at the beginning of November so I'm self-studying for finals😅😅
Thank you for this very useful video!
No problem, glad you liked it!
very detailed. clear. beautiful
thanks ALOT
really helpful
Glad it was helpful!
Cheers boss, I knew I had to use Group By but I didn't fully understand why.
Thanks, glad it was helpful!
👋 Bravo!
A very well-explained demo!
Thanks!
@@DatabaseStar....... You're very welcome!
Can you please make a crash course about "MySQL for Advanced Data Analytics"?
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?
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.
@@DatabaseStar Thanks for the awesome reply! I just subscribed.
Can you please give an example with two tables that have many to many relationships
Good idea, I can do that.
real good video, thank you!
You’re welcome!
very helpful; thank you!
Thanks!
Excellent video !
Glad you liked it!
Very good information
Thanks!
Thank you very much
You’re welcome!
thanks it really helped
Glad it helped!
Thank you 👍
No worries!
Thanks for that.
Glad it was helpful!
I honestly gonna die with this language :")
Hahah
thank you.
You're welcome
thax
You're welcome
Thanks
No problem!
Can you t sql vedios
Sure I can make TSQL videos.
🙌
Thanks!