Skip to main content
Interactive Practice

Practical Engineering Laboratories

Hands-on guided programming exercises, automated test suites, and database query environments.

Select a topic to inspect exercise instructions, sample scripts, and simulated run outputs.

Sample exercise preview
Exercise Console · SQL Database
Beginner
Laboratory Task

SQL Multi-Table Joins & Order Aggregation

Write relational queries with INNER JOIN, LEFT JOIN, GROUP BY, and HAVING to generate customer purchase summaries.

Execution Steps:

01.Inspect the relational schema for customers, orders, and line items.
02.Construct an INNER JOIN between customers and orders.
03.Group by customer ID and calculate total order count and aggregate expenditure.
04.Filter for customers with total spend exceeding 5,000 using HAVING.
Sample Script SourceRead-Only
SELECT
  c.customer_id,
  c.first_name || ' ' || c.last_name AS customer_name,
  COUNT(o.order_id) AS total_orders,
  ROUND(SUM(o.total_amount)::numeric, 2) AS lifetime_spend
FROM customers c
INNER JOIN orders o ON c.customer_id = o.customer_id
WHERE o.status = 'COMPLETED'
GROUP BY c.customer_id, c.first_name, c.last_name
HAVING SUM(o.total_amount) > 5000
ORDER BY lifetime_spend DESC;
Terminal Console Feed
Click “Simulate Execution Run” to execute the test suite in mock runner.