HomeInterview QuestionsWhat is the result of SELECT COUNT(field) FROM a t…

What is the result of SELECT COUNT(field) FROM a table containing the values 1, 1, 2, and NULL?

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

💡 Model Answer

The COUNT(column) aggregate function counts only non‑NULL values in the specified column. In a table with the rows 1, 1, 2, and NULL, COUNT(field) will return 3 because the NULL value is excluded. If you used COUNT(*) instead, it would count all rows, including the NULL, and return 4. The WHERE clause "1 = 1" is a tautology and does not filter any rows, so it has no effect on the result. Therefore, the correct answer to the query is 3.

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