What will be the output of the following query?
SELECT COUNT(*) FROM INVENTORY WHERE Model="VXI";
What will be the output of the following query?
SELECT COUNT(*) FROM INVENTORY WHERE Model="VXI";
Solution
✅ Correct Option: 2
COUNT(*) counts every row that passes the WHERE filter. Here only rows with Model = "VXI" are kept, so the query returns the number of records in the INVENTORY table whose Model is "VXI".
Option 1: ignores the WHERE condition. The filter is applied before counting.
Options 3 and 4: COUNT(*) counts whole rows, including those with NULLs in other columns. Only COUNT(column) skips NULL values in that column.
Related questions:
2025: 20 May Shift 1
2026: 19 May Shift 1
2025: 21 May Shift 1
2025: 15 May Shift 2