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
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)
| InvoiceNo | CarId | CustId | SaleDate | PaymentMode | EmpID | SalePrice | Commission |
|---|---|---|---|---|---|---|---|
| I00001 | D001 | C0001 | 2019-01-24 | Credit Card | E004 | 613248.00 | 73589.64 |
| I00002 | S001 | C0002 | 2018-12-12 | Online | E001 | 590321.00 | 70838.52 |
| I00003 | S002 | C0004 | 2019-01-25 | Cheque | E010 | 604000.00 | 72480.00 |
| I00004 | D002 | C0001 | 2018-10-15 | Bank Finance | E007 | 659982.00 | 79198.84 |
| I00005 | E001 | C0003 | 2018-12-20 | Credit Card | E002 | 369310.00 | 44318.20 |
| I00006 | S002 | C0002 | 2019-01-30 | Bank Finance | E007 | 620214.00 | 74425.68 |
a) Display the InvoiceNo and commission value rounded off to zero decimal places.
SELECT InvoiceNo, ROUND(Commission, 0) AS RoundedCommission
FROM SALE;
Output
| InvoiceNo | RoundedCommission |
|---|---|
| I00001 | 73590 |
| I00002 | 70839 |
| I00003 | 72480 |
| I00004 | 79199 |
| I00005 | 44318 |
| I00006 | 74426 |
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.