Relational inner join
Your task
Implement a relational inner join of two tables (left and right), each a list of dict rows, on a shared key column. For every pair of left and right rows with equal key, emit one merged row containing all of the left row's fields plus all of the right row's fields except a duplicate key. Preserve left-major order: iterate left rows in order and, within each, the matching right rows in their original order. Return the list of merged dict rows.
Examples
inner_join(left: list[dict], right: list[dict], key: str) -> list[dict]Example 1
Input
inner_join([{"id": 1, "name": "a"}], [{"id": 1, "age": 30}], "id")Output
| id | name | age |
|---|---|---|
| 1 | a | 30 |