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 you should combine the knowledge from different parts of the course to solve it. Let's take a look into a database of a garden shop:
customer (id, name, country)
purchase (id, customer_id, year)
purchase_item (id, purchase_id, name, quantity)
Here, customers purchase flowers.
Each purchase consists of one or more purchase_items. Each purchase_item belongs to one purchase (column
For example, if John Smith places an order for 2 roses and 1 lily, there will be two purchase_items in this specific purchase: one describing the roses (the column
quantity would contain the value 2 here) and one describing the lily (column
quantity would contain the value 1 here).
All purchase ids are stored chronologically, i.e. the last id placed in the shop has the greatest id.