For example if I wanted to count elements in a specific table
I can use
[syntax=sql]SELECT COUNT(user_id) FROM `users`[/syntax]
and
[syntax=sql]SELECT COUNT(user_id) FROM `users`
[/syntax]
the give the same number but what are the main differences between them?
Major difference between COUNT(column_name) and COUNT(*)
Re: Major difference between COUNT(column_name) and COUNT(*)
The difference is generally performance on large tables, this explains it rather well http://www.mysqlperformanceblog.com/200 ... -countcol/
Re: Major difference between COUNT(column_name) and COUNT(*)
My table is not that big it has over 100 users, so I can use either. but for the sake of speed count(*) is faster
Thanks
Thanks