Akela

Write the query. Understand the reason.

Practise SQL and ER modelling with feedback that explains mistakes, guides your next step and builds lasting database confidence.

Loading…

No setup required · Instant feedback · Learn at your own pace

Practice exampleFind the latest payment made by each customer.

SELECT customer_id, payment_date, MAX(amount)
FROM payments
GROUP BY customer_id;

Review this part of your query

payment_date is not tied to the maximum payment. Grouping returns one maximum amount for each customer, but it does not identify which payment row supplied that amount.

Hint: Find the row containing each customer's latest payment before selecting its other values.

Result previewReturned row: Customer 104 · 3 Feb 2024 · $48.00
How It Works

From attempt to understanding.

1

Attempt

Solve a focused SQL or ER Diagram exercise.

2

Review

See what worked and what needs attention.

3

Understand

Learn why the result occurred.

4

Apply

Try a related exercise and reinforce the concept.

SELECT confidence
FROM practice
WHERE mistakes = 'explained';

Your next correct answer starts with understanding the last mistake.

Practise with feedback that turns errors into the next useful step.