Skip to content
Question
Q.

Consider the following table : PRODUCT

Table : PRODUCT

PIDPNAMEPRICEQUANTITY
P1001Eraser10.505
P1002Ball Pen15.002
P1003Gel Pen25.103
P1004Ruler5.001

Find the output of the following SQL queries :

  1. SELECT 10+MOD(QUANTITY,3) FROM PRODUCT WHERE PNAME = “Eraser”;
  2. SELECT ROUND(PRICE,2)*QUANTITY FROM PRODUCT WHERE QUANTITY > 2;
  3. SELECT UCASE(RIGHT(PNAME,2)) FROM PRODUCT;
CBSECBSE Class XII Board 2022Subjective· 3mImportance★★★★★
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

This question tests your understanding of SQL functions — MOD, ROUND, UCASE, and RIGHT — by asking you to compute specific outputs from a given PRODUCT table.

Let’s look at the table first. It has four columns: PID (product ID), PNAME (product name), PRICE (in rupees, with two decimal places), and QUANTITY (number of units in stock). The data is straightforward — four products with their respective values.

Now, each query applies a different combination of SQL functions to extract or compute something. We’ll take them one by one.


(i) SELECT 10+MOD(QUANTITY,3) FROM PRODUCT WHERE PNAME = “Eraser”;

This query first filters the table to only the row where PNAME is “Eraser”. From that row, it takes the QUANTITY value — which is 5. The MOD function returns the remainder when QUANTITY is divided by 3. So MOD(5,3) gives 2 (since 5 ÷ 3 = 1 remainder 2). Then 10 is added to that result: 10 + 2 = 12.

Note

MOD is short for “modulo” — it’s the remainder after division. In NCERT textbooks, this function is used exactly as shown: MOD(a,b) returns the remainder when a is divided by b.

The output is a single number: 12.


(ii) SELECT ROUND(PRICE,2)*QUANTITY FROM PRODUCT WHERE QUANTITY > 2;

This query first selects rows where QUANTITY is greater than 2. Looking at the table, that means:

  • P1001 (Eraser) — QUANTITY 5
  • P1003 (Gel Pen) — QUANTITY 3

For each of these rows, the query does two things: it rounds the PRICE to 2 decimal places (which is already the case here — all prices have two decimals), then multiplies that rounded price by the QUANTITY.

For Eraser: ROUND(10.50,2) = 10.50, then 10.50 × 5 = 52.50

For Gel Pen: ROUND(25.10,2) = 25.10, then 25.10 × 3 = 75.30

Important

The ROUND function with a second argument of 2 simply ensures the price has exactly two decimal places. In this table, all prices already have two decimals, so ROUND doesn’t change the value — but it’s still applied as written. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.