Task: equi-join-detect (source dataset: Auto-BI)

Your are given a database with related tables used for business intelligence analysis. Your task is to identify all key/foreign-key join relationships between the tables for this database. Recall that a join is a relationship between two tables, that allows rows from one table to be combined with rows from another, based on a set of common join columns.
 
 
No explanation needed. Please return all join relationships in the following JSON format:
{
  "joins": [
    {
      "from_table": "table-1",
      "from_column": "column-1",
      "to_table": "table-2",
      "to_column": "column-3"
    }, 
	...
  ]
}

Tables:

Table: CUSTOMERS
|   customer number | Customer Name   |
|------------------:|:----------------|
|          21000010 | Customer 001    |
|          21000004 | Customer 002    |
|          21000005 | Customer 003    |
|          21000012 | Customer 004    |
|          21000014 | Customer 005    |
|          21000018 | Customer 006    |
|          21000023 | Customer 007    |
|          21000025 | Customer 008    |
|          21000030 | Customer 009    |
|          21000038 | Customer 010    |


Table: ITEMS
|   ITEM NUMBER | ITEM NAME   |
|--------------:|:------------|
|             1 | A           |
|             2 | B           |
|             3 | C           |
|             4 | D           |
|             5 | E           |
|             6 | F           |
|             7 | G           |
|             8 | H           |
|             9 | I           |
|            10 | K           |


Table: ITEM_TYPES
|   GL ACCOUNT | ITEM CATEGORY   |
|-------------:|:----------------|
|        43210 | BOOKS           |
|        48005 | SERVICES        |
|        41210 | MAGAZINES       |
|        59902 | FREIGHT         |
|        45210 | NEWSLETTERS     |


Table: sales
| ENTITY_ID   | INVOICE_NUMBER   | SALES_ORDER   | PURCHASE_ORDER   | INVOICE_DATE            | CHANNEL   | REP     |   SOLD-TO |   ITEM | SALE_CURRENCY   |   SALE_GL_ACCOUNT |   INV_QTY |   CURR_REV |   REVENUE |   COGS_MAT |   COGS_FREIGHT | REV_RECOG_ADJ   | TYPE   |
|:------------|:-----------------|:--------------|:-----------------|:------------------------|:----------|:--------|----------:|-------:|:----------------|------------------:|----------:|-----------:|----------:|-----------:|---------------:|:----------------|:-------|
| ABC         | INV000017        | NZ25521       | PO-1283          | 2019-01-10 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000035        | NZ25537       | PO-1286          | 2019-01-17 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000046        | NZ25546       | PO-1287          | 2019-01-21 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000052        | NZ25557       | PO-1289          | 2019-01-24 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000051        | NZ25555       | PO-1288          | 2019-01-23 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000061        | NZ25571       | PO-1296          | 2019-01-29 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000068        | NZ25579       | PO-1207          | 2019-01-29 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000088        | NZ25590       | PO-1299          | 2019-02-04 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000094        | NZ25597       | PO-1300          | 2019-02-05 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |
| ABC         | INV000100        | NZ25604       | PO-1303          | 2019-02-06 00:00:00.000 |           | FREIGHT |  21000301 |      9 | NZD             |             59902 |         1 |         50 |        50 |          0 |              0 |                 | ACTUAL |

 


tables: name: CUSTOMERS
data: CUSTOMERS.csv
name: ITEMS
data: ITEMS.csv
name: ITEM_TYPES
data: ITEM_TYPES.csv
name: sales
data: sales.csv
label: sales
ITEM
ITEMS
ITEM NUMBER
sales
SALE_GL_ACCOUNT
ITEM_TYPES
GL ACCOUNT
sales
SOLD-TO
CUSTOMERS
customer number
output: {
    "joins": [
        {
            "from_table": "sales",
            "from_column": "ITEM",
            "to_table": "ITEMS",
            "to_column": "ITEM NUMBER"
        },
        {
            "from_table": "sales",
            "from_column": "SALE_GL_ACCOUNT",
            "to_table": "ITEM_TYPES",
            "to_column": "GL ACCOUNT"
        },
        {
            "from_table": "sales",
            "from_column": "SOLD-TO",
            "to_table": "CUSTOMERS",
            "to_column": "customer number"
        }
    ]
}