← union operator page · set/union/n/leftmost_of_three_operands_wins
pandas ✅ · DuckDB ✅
union(DS_1, DS_2, DS_3), the list form with three operands, where the page's examples have two: id 1 is only in DS_1, id 2 in all three, id 3 in DS_2 and DS_3, and id 4 only in DS_3. The measure is 10 * Id_1 + k, with k 0, 1 and 2 for DS_1, DS_2 and DS_3.
Union: dsList ::= ds { , ds }*, the resulting Data Set "contains the Data Points belonging to any of the operand Data Sets", and duplicate Data Points "are filtered by choosing the Data Point belonging to the left most operand Data Set".
Me_1 is 10, 20, 31 and 42 for ids 1 to 4: each id keeps the data point of its leftmost operand, DS_1, DS_1, DS_2 and DS_3.
DS_r := union(DS_1, DS_2, DS_3);
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 2 | 21 |
| 3 | 31 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 2 | 22 |
| 3 | 32 |
| 4 | 42 |
{
"datasets": [
{
"name": "DS_3",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
| 3 | 31 |
| 4 | 42 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"}
]
}
]
}