Union Introduction
Introduction
A Union of 2 or more tables allows you to combine rows from different tables into a single result set or “stack” tables one on another. In this tutorial, we will discuss the concept of union and provide an example to illustrate the process.
An Overview
Tomat Union works similarly to the SQL UNION operator, but with more flexibility. It can combine tables that have different column sets by matching columns based on their names and data types. The column order in the original tables does not matter. This feature makes union tables a powerful tool for merging data from various sources with varying structures.
Example.
Consider the following two tables:
Table A:
Table B:
Although the columns in both tables are not in the same order, the union tool can combine them based on the matching column names and data types.
Result:
In the resulting union table, the matched columns (id, name, and country) are combined, while the columns with no match in the other table (age and city) are filled with NULL values.
Last updated