Your question is Write a Query for Repeated Rows. Start with the requirements and the two 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.
Zomato’s data quality team wants to identify repeated order-item records that may have been ingested more than once. Treat rows as repeated when all business columns match, excluding the unique order_item_id.
Write a PostgreSQL query to find these repeated rows and enrich the results with the restaurant name.
order_item_id values as a comma-separated list, ordered numerically.| Column | Type | Description |
|---|---|---|
| order_item_idPK | INT | Unique order-item record ID |
| restaurant_id | INT | References restaurants.restaurant_id |
| customer_id | INT | Customer identifier |
| item_name | VARCHAR(100) | Ordered menu item |
| quantity | INT | Quantity ordered |
| unit_price | DECIMAL(10,2) | Price per item |
| ordered_at | TIMESTAMP | Order creation timestamp |
| Column | Type | Description |
|---|---|---|
| restaurant_idPK | INT | Unique restaurant identifier |
| restaurant_name | VARCHAR(150) | Restaurant display name |