I recently published a blog post over on Medium about the differences in 2 versions of the MySQL
COUNT() aggregate function:
COUNT(column_name or expression). I wanted to share the post here with any readers who may be interested so continue reading for more on this post…
If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!
I look at many of my blog posts as reminders to my future self. That’s why I think it so important to share them with any others’ who can learn and benefit from them just as I do.
Most developers who work with MySQL are well-aware that
COUNT(*) returns the overall number of rows in a table or result set. However, you can use
COUNT() to count column values or expressions as well. And, these 2 different versions of
COUNT() are not the same. Confused? Then read the post, MySQL COUNT(*) and COUNT(column or expression) — Differences, to know their differences.
Consider making a small donation on my behalf as I continue to provide useful and valuable content.Thank you.
Like what you have read? See anything incorrect? Please comment below and thank you for reading!!!
A Call To Action!
Thank you for taking the time to read this post. I truly hope you discovered something interesting and enlightening. Please share your findings here, with someone else you know who would get the same value out of it as well.
Visit the Portfolio-Projects page to see blog post/technical writing I have completed for clients.
Be sure and visit the “Best Of” page for a collection of my best blog posts.
Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.
Disclaimer: The examples presented in this post are hypothetical ideas of how to achieve similar types of results. They are not the utmost best solution(s). The majority, if not all, of the examples provided, are performed on a personal development/learning workstation-environment and should not be considered production quality or ready. Your particular goals and needs may vary. Use those practices that best benefit your needs and goals. Opinions are my own.