Don't understand how COUNT works


#1

PLEASE HELP TO UNDERSTAND COUNT OPERATION!


we say that COUNT() is function that takes name of a column as an argument and counts no. of rows where column is not NULL.
Then differentiate between below statements:


Please help to explain output of the below commands. Thanks.



SELECT COUNT(*) FROM fake_apps;

SELECT COUNT(price) FROM fake_apps;


#2

SELECT COUNT(*) FROM fake_apps;

SELECT COUNT(price) FROM fake_apps;

both statement outputs are same but count(*) count complete rows in table and count(price) count only price column.if price column in any rows is null.so, null rows aren't counted.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.