Description
Join two tables into one table, based on one or multiple shared columns.
Application
Data is often not stored in a single place in engineering applications. For instance, the design parameters, operating conditions and measured performances might be stored in different tables. The join function enables to combine these different tables to obtain one big table with a format more suitable for exploration or modelling purposes.
How to use
This function requires two different tables to work properly which have to share one or more common columns in order to join them (called index column
below). The joining operation will join rows from the two tables when they share the same value for that selected column(s).
Left Table | In this field, select the first table required for the join operation. |
Right Table | In this field, select the second table require for the join operation. |
Common column(s) from left table | In this field, select one or multiple index columns of the left table which are shared with the right table. |
Common column(s) from right table | In this field, select here one or multiple index columns of the right table which are shared with the left table. |
Join method | In this field you select one of the available join methods depending on the information which you want to have in the resulting table. |
Available Join methods
Left | The resulting table will keep all information of the left table and additionally add all matching record between both tables. This can be used for example when we are mainly interested in the rows of the left table, but want to add information coming from another table. | |
Right | The method is very similar to the left join, but will keep all information of the right table instead. | |
Inner | The resulting table will only contain rows for which matching index columns is found in both tables. This can be used for example when we want a table that only show results for which we have all data. | |
Outer | The resulting table will contain all rows from the two tables, whether they have matching index columns or not. The resulting table will be bigger, but is more likely to have missing data. This can be used when we want a table containing all of the data from the two original tables. However, further processing might be needed. |
The index column(s) selected in the fields Common column(s) from left/right table will all be kept in the final table. If the tables contain other columns with the same name on both tables (e.g. column_name
), they will be both kept in the final table but renamed in order to differentiate them. In the left table the suffix _left
will be added to the column name, _right
will be added in the right table (for the example this would result in column_name_left
and column_name_right
).
Most of the time, the index column used to join tables is a unique identifier. However, sometimes more than one index column is required to uniquely identify a row. If multiple index columns are selected, the joining operation will join rows from the two tables when they share the same values on all the index columns. For this to work, the same number of index columns have to be selected for each table, and they have to be selected in the same order.
There are different join methods, depending on what information we want to have in the resulting table:
Examples
For these examples, let us consider the two following tables: The left table containing design parameters, the right table containing performance parameters.
Left table
| Right table
|
Left Join | The left table is kept completely, the matching information from the right table added. As not for all entries in the left table a matching entry in the right table was found, this operation produced missing values in this case.
| |||||||||||||||||||||||||
Right Join | The right table is kept completely, the matching information from the left table added. As not for all entries in the right table a matching entry in the left table was found, this operation produced missing values in this case.
| |||||||||||||||||||||||||
Inner Join | This operation generates a table without missing data as only the two samples are kept which are found in both tables.
| |||||||||||||||||||||||||
Outer Join | This operation produces a longer table than before which contains several missing values. But all information from both tables are available in the result.
|
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article