Home › Interview Questions › What is the difference between COUNT(*) and COUNT(…

What is the difference between COUNT(*) and COUNT(email) in SQL?

🟢 Easy Conceptual Fresher level
1Times asked
Oct 2026Last seen
Oct 2026First seen

💡 Model Answer

COUNT() counts every row in the result set, including rows where the specified column is NULL. It is a quick way to get the total number of rows. COUNT(column) counts only the rows where the column is not NULL. If a column contains NULL values, those rows are excluded from the count. For example, if a table has five rows and the email column is NULL in two of them, COUNT() will return 5 while COUNT(email) will return 3. COUNT() is often used for total row counts, while COUNT(column) is used to count non‑null values, such as the number of users who have provided an email address. The performance of both functions is similar, as the database engine typically scans the same rows, but COUNT() can be slightly faster because it does not need to check for NULLs.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.

Get Assisting AI — Starts at ₹500