What will be the output of the following command for the relation Motor?
SELECT COUNT(*) from MOTOR;
MOTOR
carid carname price model year D001 Dzire 528658 LXI 2017 D002 Dzire 673182 VXI 2019 B001 Baleno 567892 Sigma1.2 2019 B002 Baleno 355252 Delta1.2 2019 E001 EECO 352525 CARE 2018 S0001 SWIFT 514025 LXI 2015
What will be the output of the following command for the relation Motor?
SELECT COUNT(*) from MOTOR;
MOTOR
| carid | carname | price | model | year |
|---|---|---|---|---|
| D001 | Dzire | 528658 | LXI | 2017 |
| D002 | Dzire | 673182 | VXI | 2019 |
| B001 | Baleno | 567892 | Sigma1.2 | 2019 |
| B002 | Baleno | 355252 | Delta1.2 | 2019 |
| E001 | EECO | 352525 | CARE | 2018 |
| S0001 | SWIFT | 514025 | LXI | 2015 |
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.
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.
Related questions:
2025: 27 May Shift 2
2025: 20 May Shift 1
2026: 21 May Shift 1