Skip to content
Worked Examples · Example 1.1

Q.In order to increase sales, a car dealer decides to offer customers the option to pay the total amount in 10 easy EMIs (equal monthly installments), where the EMIs must be in multiples of 10,000. Using the INVENTORY table of the CARSHOWROOM database, list the CarID and Price along with the following:

(a) Calculate GST as 12% of Price and display the result after rounding it off to one decimal place.
(b) Add a new column FinalPrice to the INVENTORY table, whose value is the sum of Price and 12% of the GST.
(c) Calculate and display the amount to be paid each month (in multiples of 1,000), obtained by dividing the FinalPrice of the car into 10 instalments.
(d) After dividing the amount into EMIs, find the remaining amount to be paid immediately, using modular division.
Tripura TbseTextbookSubjective· 3mImportance★★★★★
3% · 1/40 Questions
🔒 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 →

Four steps on INVENTORY: round GST with ROUND(), store it in a new FinalPrice column, then use MOD() to split FinalPrice into a 10,000-multiple EMI and a leftover remaining amount.

This is a code/query task that chains four numeric functions together — ROUND() twice and MOD() twice — to turn a car's Price into an EMI plan.

(a) GST. GST is defined as 12% of Price, rounded to one decimal place:

SELECT CarId, Price, ROUND(12/100*Price, 1) "GST" FROM INVENTORY;

12/100*Price computes the 12% amount; ROUND(..., 1) keeps one decimal place, exactly as asked. The quoted "GST" after the expression names the output column.

(b) FinalPrice. The question says FinalPrice is "the sum of Price and 12% of the GST" — read together with the book's own query, this means Price plus the GST amount computed in (a) (GST itself already is 12% of Price):

ALTER TABLE INVENTORY ADD FinalPrice Numeric(10,1);
UPDATE INVENTORY SET FinalPrice = Price + ROUND(Price*12/100, 1);

The ALTER TABLE creates the column; the UPDATE fills every row with Price + its rounded GST.

Displaying the table now shows the newly filled column:

SELECT * FROM INVENTORY;
CarIdCarNamePriceModelYearManufactureFuelTypeFinalPrice
D001Car1582613.00LXI2017Petrol652526.6
D002Car1673112.00VXI2018Petrol753885.4
B001Car2567031.00Sigma1.22019Petrol635074.7
B002Car2647858.00Delta1.22018Petrol725601.0
E001Car3355205.005STR STD2017CNG397829.6
E002Car3654914.00CARE2018CNG733503.7
S001Car4514000.00LXI2017Petrol575680.0
S002Car4614000.00VXI2018Petrol687680.0
Watch out

Don't add a SECOND 12% on top of the GST value (e.g. Price + 0.12*GST) — that is not what the query does. FinalPrice = Price + GST, where GST = ROUND(Price*0.12, 1).

(c) and (d) — EMI and the remaining amount. With FinalPrice known, splitting it into 10 EMIs that must land on a multiple of 1,000 is exactly what MOD() is for:

SELECT CarId, FinalPrice,
       ROUND((FinalPrice - MOD(FinalPrice,10000))/10, 0) "EMI",
       MOD(FinalPrice, 10000) "Remaining Amount"
FROM INVENTORY;
  • MOD(FinalPrice, 10000) — the part of FinalPrice that is NOT a clean multiple of 10,000. That fragment is what the dealer collects immediately, as the "Remaining Amount".
  • FinalPrice - MOD(FinalPrice, 10000) — what's left is now an exact multiple of 10,000, so dividing it by 10 gives an EMI that is itself a clean multiple of 1,000, as the question requires. …

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.