Excellent! Looks like you've mastered all parts of the SQL Basics course. Congratulations!
Before you finish, we have one final task for you. It's a bit more complicated than the previous tasks and will require that you combine your knowledge from different parts of the course to solve it. Let's take a look at a database of a garden shop:
Customer (Id, Name, Country)
Purchase (Id, CustomerId, Year)
PurchaseItem (Id, PurchaseId, Name, Quantity)
Here, customers purchase flowers. Each purchase consists of one or more
PurchaseItem belongs to one purchase (column
For example, if John Smith places an order for two roses and one lily, there will be two
PurchaseItems in this specific purchase: one describing the roses (
Quantity = 2) and one describing the lily (
Quantity = 1).
All purchase IDs are stored chronologically – i.e., the last ID placed in the shop has the greatest ID.