Skip to content
Activities · Activity 9.15

Q.a) List the total number of cars sold by each employee.

b) List the maximum sale made by each employee.
Karnataka PUCTextbookSubjective· 4mImportance★★★★★
32% · 30/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 question asks for two SQL aggregation queries on the real SALE table of the CARSHOWROOM database (Table 9.11) — there is no separate CarSales table in this schema. The core idea is GROUP BY with aggregate functions COUNT() and MAX().

The real SALE table (Table 9.11)

InvoiceNoCarIdCustIdEmpIDSalePrice
I00001D001C0001E004613248.00
I00002S001C0002E001590321.00
I00003S002C0004E010604000.00
I00004D002C0001E007659982.00
I00005E001C0003E002369310.00
I00006S002C0002E007620214.00

Each row of SALE already represents one car sold by one employee (EmpID), so GROUP BY EmpID on this real table directly answers both parts — no separate CarSales table is needed or exists in this schema.


a) List the total number of cars sold by each employee.

SELECT EmpID, COUNT(*) AS TotalCarsSold
FROM SALE
GROUP BY EmpID;

COUNT(*) counts the rows in each employee's group — each row is one car sold. Employee E007 appears twice (I00004 and I00006); every other employee in this data sold exactly one car.

Output

EmpIDTotalCarsSold
E0011
E0021
E0041
E0072
E0101

b) List the maximum sale made by each employee.

SELECT EmpID, MAX(SalePrice) AS MaxSale
FROM SALE …

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.