# Merge Join

{% hint style="warning" %}
**Workshop - Merge Join**

A workshop to illustrate various SQL joins.

In this workshop, we're going to run through the various join types available in the Merge join step.
{% endhint %}

{% embed url="<https://www.loom.com/share/cdbbff783c7549e09cf9fddef5ccefde>" %}

***

{% hint style="info" %}
**Create a new Transformation**

Any one of these actions opens a new Transformation tab for you to begin designing your transformation.

* By clicking File > New > Transformation
* By using the CTRL-N hot key
  {% endhint %}

<figure><img src="/files/dgHWlaPxq9BeHE4bFoXn" alt="" width="375"><figcaption><p>Merge Join</p></figcaption></figure>

{% tabs %}
{% tab title="1. Data Grid" %}
{% hint style="info" %}
**Data grid**

The Data grid step allows you to enter a static list of rows in a grid. This is usually done for testing, reference or demo purposes.

Options

* Meta tab: You can specify the field metadata (output specification) of the data
* Data tab: This grid contains the data. Everything is entered in String format so make sure you use the correct format masks in the metadata tab.
  {% endhint %}

1. Drag the Data Grid step onto the canvas.
2. Open the Data Grid properties dialog box.
3. Ensure the following details are configured, as outlined below:

<div align="left"><figure><img src="/files/nXZbbLNpCsFBPVbaz5ib" alt=""><figcaption><p>ABCD - Data Grid</p></figcaption></figure> <figure><img src="/files/5h0mHmmKTNOQMoM8rYxo" alt=""><figcaption><p>Red Blue Yellow - data grid</p></figcaption></figure></div>
{% endtab %}

{% tab title="2. Merge Join" %}
{% hint style="info" %}
**Merge Join**

The Merge Join step performs a classic merge join between data sets with data coming from two different input steps. Join options include INNER, LEFT OUTER, RIGHT OUTER, and FULL OUTER.
{% endhint %}

1. Drag the Merge Join step onto the canvas.
2. Open the Merge Join properties dialog box.
3. Select various Join Types to view the resulting dataset

<figure><img src="/files/xvgn45La24cNjvq0mqex" alt="" width="375"><figcaption><p>Merge Join</p></figcaption></figure>

{% hint style="warning" %}
Obviously you need to join on a unique key(s)
{% endhint %}
{% endtab %}

{% tab title="3. RUN" %}

1. Click the Run button in the Canvas Toolbar.
2. Click on the Dummy step Preview tab:

**INNER Join**

<figure><img src="/files/JLWjg6Mzj00L9mAGcQru" alt=""><figcaption><p>INNER Join</p></figcaption></figure>

**LEFT OUTER Join**

<figure><img src="/files/2xYxox7DsedbQ0xUiTfa" alt=""><figcaption><p>LEFT OUTER Join</p></figcaption></figure>

**RIGHT OUTER Join**

<figure><img src="/files/sgFXkfYOdmGMpW2YUZuB" alt=""><figcaption><p>RIGHT OUTER Join</p></figcaption></figure>

**FULL OUTER Join**

<figure><img src="/files/kyFju85hBemtlZ0Fa0nu" alt=""><figcaption><p>FULL OUTER Join</p></figcaption></figure>

{% hint style="info" %}
Now give it a go with the 'Merge Streams' scenario ..
{% endhint %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://academy.pentaho.com/pentaho-data-integration/data-integration/enrich-data/joins/merge-join.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
