Activities · Activity 1.5
Q.(a) Find sum of Sale Price of the cars purchased by the customer having ID C0001 from table SALE.
(b) Find the maximum and minimum commission from the SALE table.
Uttar Pradesh UpmspTextbookSubjective· 3mImportance★★★★★
25% · 10/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 →SUM() totals SalePrice for a filtered customer; MAX()/MIN() find the highest and lowest Commission across the whole SALE table — the same real CARSHOWROOM data used throughout this chapter.
This is a code/query task on the SALE table (with the Commission column added and filled in Example 1.2):
| 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) Filter to customer C0001, then total the SalePrice column:
SELECT SUM(SalePrice) FROM SALE WHERE CustId='C0001';
C0001 appears in two rows — I00001 (613247.00) and I00004 (659982.00). SUM() adds them: 613247.00 + 659982.00 = 1273229.00. …
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.