Skip to main contentSkip to solution

What will be the output of the following command for the relation Motor?

SELECT COUNT(*) from MOTOR;

MOTOR

caridcarnamepricemodelyear
D001Dzire528658LXI2017
D002Dzire673182VXI2019
B001Baleno567892Sigma1.22019
B002Baleno355252Delta1.22019
E001EECO352525CARE2018
S0001SWIFT514025LXI2015

Solution

✅ Correct Option: 1

COUNT(*) counts every row in the table, including rows with NULL values. The MOTOR table has 6 rows (D001, D002, B001, B002, E001, S0001), so the output is a single value, 6.

COUNT(∗)=6\text{COUNT}(*) = \boxed{6}


Option 2: 7 would be right only if the header row were counted, but column names are not rows.

Option 3: 5 would be the result of COUNT(DISTINCT carname) only if there were 5 names, but there are only 4 distinct car names (Dzire, Baleno, EECO, SWIFT), and COUNT(*) does not remove duplicates in any case.

Keyboard Shortcuts

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