The usage of COUNT() function is useful in writing SQL queries. I have explained how you can use this function as per your requirement.
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.
The COUNT(Expression) or COUNT(ALL Expression) function gives a count of rows except Null values.
The COUNT(DISTINCT function) gives a count of all rows except duplicates and Null values.