The usage of COUNT() function is useful in writing SQL queries. I have explained how you can use this function as per your requirement.
COUNT(*)
Counting rows in SQL is you can do with a function in SQL. The COUNT(*) function in SQL gives a count of Null values, Non-null values, and Duplicate values.
COUNT(Expression)
The COUNT(Expression) or COUNT(ALL Expression) function gives a count of rows except Null values.
COUNT(DISTINCT function)
The COUNT(DISTINCT function) gives a count of all rows except duplicates and Null values.