Advertisements
Advertisements
Question
Differentiate between COUNT()
and COURT(*)
functions in MYSQL
. Give suitable examples to support your answer.
Distinguish Between
Solution
count() | count(*) |
To find the number of rows in a given column, use the count() method. NULL values are not included in the count() function's count. | To count every row that contains null values, utilise the count(*) method. |
For example: Five rows, including one with null values, make up the following table.
Demo
ID | Name |
1 | Ajeem |
2 | NULL |
3 | Koyal |
4 | Saira |
Mysql>Select count(Name) from Demo; will return 3, but
Mysql>Select count(*) from Demo; will return 4
shaalaa.com
Is there an error in this question or solution?