Skip to main contentSkip to solution

Consider the following table "Manager".

Manager

MIDMNAME
1KAMAL
2ARPIT
NULLANIL
4NULL
5ARTI

What will be the output of the following SQL statement?

SELECT COUNT(*) from Manager;

Solution

✅ Correct Option: 2

COUNT(*) counts every row in the table, whether or not any column in that row holds NULL. The table has 5 rows, so the output is 5\boxed{5}.


Option 1: this is the result of COUNT(MID) or COUNT(MNAME), which skip NULL values in that column. Each column has one NULL, so each gives 4. COUNT(*) does not skip them.

Option 3: no common SQL count over this table gives 3.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question