Skip to content

Lesson 11 ยท Joining and Aggregating

Joining and Concatenating Tables in KNIME

Combine tables with Joiner, Concatenate, and Value Lookup, choose a join mode, check unmatched rows, and spot duplicate keys that silently multiply your totals.

Data is usually split across tables: orders in one, customers in another, products in a third. Combining them is where many of the most expensive mistakes happen. This lesson shows the tools and the checks that protect you.

Two directions

Two ways to combine

Join Adds columns by matching keys
Concatenate Stacks rows on top

Value Lookup is a simple form of adding columns

1 / 2

Concatenate puts tables on top of each other, for example January and February orders. Columns are matched by name. Check the settings for columns that exist in only one table, and for duplicate row IDs.

Joiner matches rows from two input tables using one or more key columns, such as customer_id, and places their columns side by side.

Join modes

A join mode decides what happens to rows without a match:

Mode Keeps
Inner Only matching rows
Left outer All left rows, plus matches
Right outer All right rows, plus matches
Full outer All rows from both sides

The Joiner node can also send unmatched left and unmatched right rows to separate output ports if you turn on that option. That is extremely useful: you can inspect or save every row that failed to match.

SQL Stand-in: inner join, left join, and unmatched rows

Press Run (or Ctrl + Enter) to see the result here.

Order 12 disappears in the inner join. If you only looked at the inner result, revenue would be lower than the truth with no warning.

Matching keys

Before joining, make keys comparable:

  • Types must be compatible. A text "007" and a number 7 do not match.
  • Spaces and case can differ. Clean them first, as in cleaning text.
  • Missing keys should be handled on purpose. Decide whether they are errors.

Also decide how to treat columns with the same name in both tables, such as two columns called date. Rename them before joining so nobody confuses order date with signup date.

The duplicate-key explosion

If the right table has two rows for the same key, each matching left row is repeated twice. The join still succeeds, but your revenue doubles for that customer.

SQL Stand-in: duplicate keys multiply totals

Press Run (or Ctrl + Enter) to see the result here.

To prevent this, check the lookup side for duplicate keys before the join, for example with a GroupBy that counts rows per key. Then either remove duplicates with a deliberate rule or choose one address type.

Value Lookup

When you only need to add a few values from a reference table, such as a region name for each country code, the Value Lookup node is simple and efficient. It takes your data table and a dictionary table, matches a column, and appends values. The key columns do not need to share a name. KNIME's best practices recommend it where it can replace a heavier join. Check how your settings treat keys that appear more than once in the dictionary.

The join checklist

  1. Count rows in each input.
  2. Check the lookup side for duplicate keys.
  3. Choose the join mode on purpose.
  4. Inspect unmatched rows.
  5. Compare totals before and after the join.

A join that returns more rows than the left table, when each left row should match at most once, signals a duplicate key. Stop and fix it before any totals are calculated.

Joining on several columns

Some matches need more than one key. A price list might be keyed by product code and country, because the same product has different prices in different places. The Joiner lets you match on several column pairs. If you join on product code alone, each order line matches one price per country, and the rows multiply. When you design a join, ask what makes a row on the lookup side unique. That set of columns is the key you should use.

Joins on ranges, such as "the price valid on the order date", are a different problem. A basic join matches equal values, so you need another approach, for example a join followed by a filter on the date range, or a database query. Verify that each order ends up with exactly one price.

Column handling

After a join you often have two copies of the key and some columns you do not need. Use the column selection settings or a column filter to keep only what is useful. If two input tables share column names, one of them has to be renamed in the output. Rename on purpose, using names that say where the data came from.

Reading the numbers

Write down this small table for each important join. It takes a minute and catches most errors.

Measure Value
Left rows counted before
Right rows counted before
Distinct keys on the lookup side should equal its rows
Matched left rows from output
Unmatched left rows from the extra port or a check

Matched plus unmatched should explain every left row. If it does not, a duplicate key or a setting you did not intend is involved.

Practice task

Create an orders table and a customer table in which one order refers to a customer who does not exist and one customer appears twice. Run an inner join and a left outer join, and record the row count and revenue total for each. Then fix the duplicate customer with a rule you can explain, run both joins again, and compare. Finally, concatenate two monthly order tables where one has an extra column, and look at how the output handles it. Write down what you saw, because these are exactly the behaviors that surprise people in real projects.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which join keeps every row from the left table, matched or not?

    A left outer join keeps all left rows and adds matches where they exist.
  2. 2. What do you use to stack January and February tables?

    Concatenate appends rows; Joiner adds columns by keys.
  3. 3. A join doubles revenue for some customers. What is the likely cause?

    Each duplicate key repeats the matching left rows.
  4. 4. Why inspect unmatched rows?

    Unmatched rows often point to data quality problems.

Summary

  • Concatenate stacks rows; Joiner adds columns by keys.
  • Choose inner, left, right, or full outer deliberately.
  • Check unmatched rows and key types.
  • Duplicate keys multiply rows and totals.
  • Value Lookup is a light option for dictionary-style enrichment.

Next: Grouping and Pivoting

Your progress is saved in this browser. No account needed.