Your question is Customers With Most Purchase Transactions. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Meta Shops wants to identify customers tagged as Meta Quest Owners who make the most purchase transactions. Write a PostgreSQL query that returns every customer with this tag, including tagged customers who have made no purchases.
customer_tags using the exact tag Meta Quest Owners.customer_id ascending to break ties.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| tag_idPK | INTEGER | Unique tag record identifier |
| customer_id | INTEGER | Customer associated with the tag |
| tag_name | VARCHAR(100) | Tag assigned to the customer |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INTEGER | Unique purchase transaction identifier |
| customer_id | INTEGER | Customer who made the purchase |
| product_name | VARCHAR(150) | Purchased product name |
| purchased_at | DATE | Date of the purchase |