Describe the differences between JOINs and window functions, and give an example of when you would use each in a data analysis task at Zomato.
Keep the answer focused on analytical use cases and the result each technique produces. Use one short example for each approach.
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| restaurant_id | INT | Restaurant associated with the order |
| customer_id | INT | Customer who placed the order |
| order_date | DATE | Date when the order was placed |
| order_value | NUMERIC(10,2) | Order amount in currency units |
| Column | Type | Description |
|---|---|---|
| restaurant_idPK | INT | Unique restaurant identifier |
| restaurant_name | VARCHAR(255) | Restaurant name |
| city | VARCHAR(100) | City where the restaurant operates |
| cuisine_type | VARCHAR(100) | Primary cuisine type |
| is_active | BOOLEAN | Whether the restaurant is active |
| Column | Type | Description |
|---|---|---|
| restaurant_id | INT | Restaurant identifier |
| stat_month | DATE | Month of the metric snapshot |
| monthly_orders | INT | Number of orders in the month |
| monthly_revenue | NUMERIC(12,2) | Revenue in the month |