← inner_join operator page · join/inner_join/keep/manual_ex_1
pandas ✅ · DuckDB ✅
keep Me_1, d2#Me_2, Me_1A on two operands that both have Me_2: the aliases let d2#Me_2 name one of them.
Inner Join, Example 1, output verbatim: "keep will maintain all the identifiers and only the specified non-identifier components", and then "all components that originally appeared in multiple input data sets, are renamed by stripping their previously determined prefix".
the keys in both operands, (1,A) and (1,B); d1#Me_2 goes and d2#Me_2 becomes Me_2 (Q, T).
DS_r := inner_join (DS_1 as d1, DS_2 as d2 keep Me_1, d2#Me_2, Me_1A );
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 1 | A | A | B |
| 1 | B | C | D |
| 2 | A | E | F |
{
"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": "String", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1A | Me_2 |
|---|---|---|---|
| 1 | A | B | Q |
| 1 | B | S | T |
| 3 | A | Z | M |
{
"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_1A", "type": "String", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | Me_1 | Me_2 | Me_1A |
|---|---|---|---|---|
| 1 | A | A | Q | B |
| 1 | B | C | T | S |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"},
{"name": "Me_2", "type": "String", "role": "Measure"},
{"name": "Me_1A", "type": "String", "role": "Measure"}
]
}
]
}