Skip to main contentSkip to solution

Consider the following table named “Product”, showing details of products being sold in a grocery shop.

PCodePNameUPrice
P01SOAP200
P02SHAMPOONULL
P03COMP50

Write the output produced by the following SQL command:

SELECT COUNT(UPrice) FROM Product;

Solution

✅ Correct Option: 3

COUNT(column) counts only the non-NULL values in that column. UPrice has values 200, NULL and 50, so only 200 and 50 are counted, giving 2.


Option 1: 3 is what COUNT(*) would return, because it counts all rows including those with NULL.

Keyboard Shortcuts

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