← left_join operator page · join/left_join/bare/left_keys_kept
pandas ✅ · DuckDB ✅
the left join of two operands with the same identifiers, with no clause.
Left Join: when "all the join operands from the second on have exactly the same identifiers and the left-most operand contains them all", "the using clause is optional"; the join is "according to SQL left-outer join", and the "Measures coming from that data set take the null value" when a key is not found.
the four keys of DS_1, (1,A), (1,B), (2,A) and (2,B), with Me_2 null at (1,B); (1,C) is in DS_2 only and is not kept.
DS_r := left_join(DS_1, DS_2);
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 20 |
| 2 | A | 30 |
| 2 | B | 40 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_2 |
|---|---|---|
| 1 | A | 1 |
| 1 | C | 2 |
| 2 | A | 3 |
| 2 | B | 4 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_2", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 1 | A | 10 | 1 |
| 1 | B | 20 | |
| 2 | A | 30 | 3 |
| 2 | B | 40 | 4 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}