5. Query Block - Join
Last updated
Last updated
Join is used when you want to merge two tables within one Query Block. For example, you may want to use the Ethereum transaction table and the address label information from metadata. Using join, you can match the from or to address of the Ethereum transaction with the label to merge the tables.
Select the new table you want to join in the table selection window.
You can change the Join option between the two tables. There are four Join options available: Inner, Left Outer, Right Outer, and Full Outer. The default option is Inner Join.
Inner Join: Inner Join returns only the matching rows from both tables based on the join condition specified. The result set only includes the rows that have matching values in both tables.
Left Outer Join: A Left Outer Join returns all the rows from the left table (the first table in the join clause), and the matching rows from the right table (the second table in the join clause). If there is no match, NULL values will be displayed for the right table's columns.
Right Outer Join: The Right Outer Join is similar to the Left Outer Join, but returns all the rows from the right table and the matching rows from the left table. If there is no match, NULL values will be displayed for the left table's columns.
Full Outer Join: A Full Outer Join returns all the rows from both tables, with matching rows combined, and non-matching rows from either table displayed as NULL values. If there is no match in either table, NULL values will be displayed for all columns from the non-matching table.
By default, the first table selected is referred to as t1, and the newly added table for joining as t2. The name of the tables can be customized.
After selecting the table to join, the on condition needs to be selected at the bottom. The on condition determines which column to base the joining of the two tables on. For example, the "to address" of the transaction and the "address" of the label table can be matched. In this case, the "to_address" column from t1 and the "address" column from t2 are selected. If the data in the selected on columns is the same, the information from the two tables is considered connected and merged.