Saved Bookmarks
| 1. |
What is difference between working of the following functions? Count(*),Count (), Count (DISTINCT), Count (ALL) |
|
Answer» Count(*):- The COUNT(*) function returns the number of records in a table: SELECT COUNT(*) FROM student; Count ():- The COUNT() function returns the number of values (NULL values will not be counted) of the specified column: SELECT COUNT(name) FROM student; Count (DISTINCT):- The COUNT(DISTINCT column_name) function returns the number of distinct values of the specified column: SELECT COUNT(DISTINCT city) FROM student; Count (ALL):- to count the number of non-null values in column dept, i.e. counting repetitions too. SELECT COUNT(ALL) FROM student; |
|