Union All
Union all
concatenates tables together. For example, if I have a table for every state, I could concatenate them into one table for the whole country.
UNION ALL WITH table1, table2, ...;
The schema of each table is carried into the unioned table; no attribute is dropped. If the initial schemas match, then the unioned table will have the same exact schema. If there is an attribute in one schema that is different, then the unioned table will include it at the end of the schema.
Matching attributes must have matching types
If the schemas have a matching attribute, the attribute must be the same type in each schema for them to be unioned correctly.
For example, let's say I have a Massachusetts and Vermont table with resident information.
Massachusetts.csv:
ID | Name | Surname |
---|---|---|
002 | John | Smith |
003 | Sarah | Brown |
004 | Alex | Jones |
Vermont.csv:
First_Name | Surname |
---|---|
Abby | Elliot |
Ben | Anderson |
Carol | Baldwin |
If I want to union these two tables together, I tell the Transformation System to first use Massachusetts.csv and concatenate with Vermont.csv:
Use Massachusetts.csv; UNION ALL WITH Vermont.csv
My unioned table will look like:
ID | Name | Surname | First_Name |
---|---|---|---|
002 | John | Smith | |
003 | Sarah | Brown | |
004 | Alex | Jones | |
Elliot | Abby | ||
Anderson | Ben | ||
Baldwin | Carol |
Updated over 5 years ago