Join on differently named keys
Your task
Given orders with columns order_id, customer, amount, status and placed, and people with columns handle and city, join customer to handle and return order_id and city for the orders whose customer is known, sorted by order_id ascending.
Examples
orders_with_city(orders: dataframe, people: dataframe) -> dataframeExample 1
Input
orders_with_city(orders, people)orders
| order_id | customer | amount | status | placed |
|---|---|---|---|---|
| 1 | ada | 120.5 | paid | 2024-01-05 |
| 2 | bo | 80 | refunded | 2024-01-07 |
| 3 | ada | 45.25 | paid | 2024-02-11 |
| 4 | cy | 200 | paid | 2024-02-14 |
| 5 | bo | 15.75 | pending | 2024-03-02 |
| 6 | ada | 60 | paid | 2024-03-19 |
people
| handle | city |
|---|---|
| ada | Oslo |
| cy | Lima |
Output
| order_id | city |
|---|---|
| 1 | Oslo |
| 3 | Oslo |
| 4 | Lima |
| 6 | Oslo |