Activities · Activity 1.1
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.
CBSENCERTSubjective· 3mImportance★★★★★
5% · 2/40 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 →ROUND(Commission, 0) rounds the commission to a whole number; WHERE PaymentMode = 'Credit Card' filters to only credit-card sales — both on the real SALE table (with Commission already filled in by Example 1.2, 12% of SalePrice).
This is a code/query task on the SALE table:
| InvoiceNo | CarId | CustId | SaleDate | PaymentMode | EmpID | SalePrice | Commission |
|---|---|---|---|---|---|---|---|
| I00001 | D001 | C0001 | 2019-01-24 | Credit Card | E004 | 613247.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 | 79197.84 |
| I00005 | E001 | C0003 | 2018-12-20 | Credit Card | E002 | 369310.00 | 44317.20 |
| I00006 | S002 | C0002 | 2019-01-30 | Bank Finance | E007 | 620214.00 | 74425.68 |
(a) ROUND(Commission, 0) rounds each commission to the nearest whole rupee:
SELECT InvoiceNo, ROUND(Commission, 0) FROM SALE;
| InvoiceNo | ROUND(Commission, 0) |
|---|---|
| I00001 | 73590 |
| I00002 | 70839 |
| I00003 | 72480 |
| I00004 | 79198 |
| I00005 | 44317 |
| I00006 | 74426 |
(b) A WHERE clause filters to only the credit-card rows:
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.