LUCENT GRID
Data Engineering Lab ยท Aggregates & Reporting
Loading sales_db...
๐Ÿ–ฅ๏ธ
SQL Terminal
๐Ÿ“Š
Data Schema
๐Ÿ“ˆ
Report Preview
๐Ÿ“Œ REPORT REQUIREMENTS
โ—‹Total orders by region (GROUP BY)
โ—‹Revenue per product category (SUM)
โ—‹Average order value (AVG)
โ—‹Top 3 reps by revenue (ORDER BY + LIMIT)
โ—‹Filter: categories over ยฃ50k (HAVING)
โ—‹Send report to manager
0 / 6 complete
SQL TERMINAL โ€” sales_db
MySQL 8.0 โ€” sales_db (Q1 2024) Tables: orders, products, reps, regions Manager request received โ€” weekly summary report due by EOD โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
mysql>
SCHEMA โ€” sales_db
orders
โ€ข id (PK)
โ€ข rep_id (FK)
โ€ข product_id (FK)
โ€ข region_id (FK)
โ€ข amount_gbp
โ€ข order_date
โ€ข 4,812 rows
products
โ€ข id (PK)
โ€ข name
โ€ข category
โ€ข unit_price_gbp
โ€ข 87 rows
reps
โ€ข id (PK)
โ€ข full_name
โ€ข region_id (FK)
โ€ข hire_date
โ€ข 24 rows
regions
โ€ข id (PK)
โ€ข name
โ€ข 4 rows
WEEKLY REPORT โ€” PREVIEW
REGIONAL SALES SUMMARY โ€” Q1 2024
Complete the queries to populate this report.
โ˜ฐ BRIEF
๐Ÿ–ฅ Terminal
๐Ÿ“Š Schema
๐Ÿ“ˆ Report
MISSION BRIEF

MISSION BRIEFING

WEEKLY REPORT โ€” STERLING SALES GROUP

SCENARIO

Your sales manager needs the weekly performance summary before the Monday stand-up. She wants: total orders by region, revenue by product category, average order value, the top 3 reps by revenue, and only categories that exceeded ยฃ50,000 this quarter. Build each query and the report fills automatically.

REQUIRED QUERIES

  • Orders per region: SELECT r.name, COUNT(o.id) FROM orders o JOIN regions r ON o.region_id=r.id GROUP BY r.name;
  • Revenue by category: SELECT p.category, SUM(o.amount_gbp) FROM orders o JOIN products p ON o.product_id=p.id GROUP BY p.category;
  • Average order value: SELECT AVG(amount_gbp) FROM orders;
  • Top 3 reps: SELECT r.full_name, SUM(o.amount_gbp) FROM orders o JOIN reps r ON o.rep_id=r.id GROUP BY r.full_name ORDER BY 2 DESC LIMIT 3;
  • HAVING filter: SELECT p.category, SUM(o.amount_gbp) as revenue FROM orders o JOIN products p ON o.product_id=p.id GROUP BY p.category HAVING revenue > 50000;

TIP

You can type shortened versions โ€” the terminal recognises the key clauses. Each successful query populates the Report Preview window and checks off a goal.

Display Mode
LAB COMPLETE
๐Ÿ†
REPORT DELIVERED
Aggregates & Reporting โ€” Sterling Sales Group
โšก
+50 XP
EXPERIENCE EARNED
โฌ† LEVEL UP โ€” Level
โ†’ Return to Labs