Skip to content
Activities · Activity 9.10

Q.Using the table SALE of CARSHOWROOM database, write SQL queries for the following:

a) Display the InvoiceNo and commission value rounded off to zero decimal places.
b) Display the details of SALE where payment mode is credit card.
Puducherry TnboardTextbookSubjective· 4mImportance★★★★★
21% · 20/95 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 →

This uses the real SALE table of the CARSHOWROOM database, with its Commission column already computed as 12% of SalePrice per Example 9.19 (Section 9.8.1) — ROUND() for part (a), a WHERE filter for part (b). The exact Commission values below are the platform-of-record values as printed for the full SALE table in Section 9.9 of the textbook.

The real SALE table (with Commission, as printed in Section 9.9)

InvoiceNoCarIdCustIdSaleDatePaymentModeEmpIDSalePriceCommission
I00001D001C00012019-01-24Credit CardE004613248.0073589.64
I00002S001C00022018-12-12OnlineE001590321.0070838.52
I00003S002C00042019-01-25ChequeE010604000.0072480.00
I00004D002C00012018-10-15Bank FinanceE007659982.0079198.84
I00005E001C00032018-12-20Credit CardE002369310.0044318.20
I00006S002C00022019-01-30Bank FinanceE007620214.0074425.68

a) Display the InvoiceNo and commission value rounded off to zero decimal places.

SELECT InvoiceNo, ROUND(Commission, 0) AS RoundedCommission
FROM SALE;

Output

InvoiceNoRoundedCommission
I0000173590
I0000270839
I0000372480
I0000479199
I0000544318
I0000674426

b) Display the details of SALE where payment mode is credit card.

SELECT *
FROM SALE
WHERE PaymentMode = 'Credit Card';
``` …

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.