Comments (5)

COUNT(*) counts total tuples regardless of NULLs. COUNT(column) evaluates non-NULL values only. When the student gets 0, 0 is a valid integer value, not NULL. So COUNT(*) is still 5, and COUNT(Marks) becomes 5! Case closed.
Also remember for viva: NULL + anything in SQL evaluates to NULL! Examiners love asking that.
Ayy thanks bro! The "0 is a value, NULL is absence of value" phrasing made it crystal clear.
Try running: SELECT COUNT(*), COUNT(1), COUNT("Padhai") FROM table; All three give the exact same answer! Because literal constants are treated as non-null rows.
Didn't know about COUNT("Padhai"), learned something new today!

Please log in to comment

Log In