← inner_join operator page · join/inner_join/using/subset_of_identifiers
pandas ✅ · DuckDB ✅
using Id_1 only, on operands with Id_1 and Id_2 that share no (Id_1, Id_2) key; the renames name the two Id_2.
Inner Join: with using, it "only uses the remaining identifiers as join keys"; the other components of several data sets "appear as many times as the data sets they come from", with a prefix.
Id_1 = 1 pairs both data points of DS_1 with the one of DS_2: (1,A,C) and (1,B,C) as Id_1, Id_21, Id_22. The natural join would match nothing, and without the renames, stripping the prefixes would give two Id_2, an error.
DS_r := inner_join(DS_1 as d1, DS_2 as d2 using Id_1 rename d1#Id_2 to Id_21, d2#Id_2 to Id_22);
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 20 |
| 2 | B | 30 |
{
"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 | C | 1 |
| 3 | D | 3 |
{
"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_21 | Id_22 | Me_1 | Me_2 |
|---|---|---|---|---|
| 1 | A | C | 10 | 1 |
| 1 | B | C | 20 | 1 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_21", "type": "String", "role": "Identifier"},
{"name": "Id_22", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "Me_2", "type": "Number", "role": "Measure"}
]
}
]
}