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: Dates
| Date                    |   Year |   Quarter Num | Quarter Year   |   Quarter Year Order |   Month Num | Month Name   | Month Year              |   Month Year Order |   Week Num | Week Year   |   Week Year Order | Week Ending             |   Month Day Num |   Date Int |   Day Num Week | Day Name   | Weekend   | Day Name Short   |   Index |   Day of Year |   ShortYear | FY   | Mnth   |   RelativeYear |   RelativeWeek |   RelativeMonth |   RelativeDay | Quarter   |
|:------------------------|-------:|--------------:|:---------------|---------------------:|------------:|:-------------|:------------------------|-------------------:|-----------:|:------------|------------------:|:------------------------|----------------:|-----------:|---------------:|:-----------|:----------|:-----------------|--------:|--------------:|------------:|:-----|:-------|---------------:|---------------:|----------------:|--------------:|:----------|
| 2021-12-26 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          12 | December     | 2021-12-01 00:00:00.000 |             202112 |         52 | W52 2021    |            202152 | 2021-12-26 00:00:00.000 |              26 |   20211226 |              7 | Sunday     | Y         | Sun              |    4378 |           360 |          21 | FY22 | Dec    |              0 |             37 |               8 |           258 | Q4        |
| 2021-12-19 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          12 | December     | 2021-12-01 00:00:00.000 |             202112 |         51 | W51 2021    |            202151 | 2021-12-19 00:00:00.000 |              19 |   20211219 |              7 | Sunday     | Y         | Sun              |    4371 |           353 |          21 | FY22 | Dec    |              0 |             36 |               8 |           251 | Q4        |
| 2021-12-12 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          12 | December     | 2021-12-01 00:00:00.000 |             202112 |         50 | W50 2021    |            202150 | 2021-12-12 00:00:00.000 |              12 |   20211212 |              7 | Sunday     | Y         | Sun              |    4364 |           346 |          21 | FY22 | Dec    |              0 |             35 |               8 |           244 | Q4        |
| 2021-12-05 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          12 | December     | 2021-12-01 00:00:00.000 |             202112 |         49 | W49 2021    |            202149 | 2021-12-05 00:00:00.000 |               5 |   20211205 |              7 | Sunday     | Y         | Sun              |    4357 |           339 |          21 | FY22 | Dec    |              0 |             34 |               8 |           237 | Q4        |
| 2021-11-28 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          11 | November     | 2021-11-01 00:00:00.000 |             202111 |         48 | W48 2021    |            202148 | 2021-11-28 00:00:00.000 |              28 |   20211128 |              7 | Sunday     | Y         | Sun              |    4350 |           332 |          21 | FY22 | Nov    |              0 |             33 |               7 |           230 | Q4        |
| 2021-11-21 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          11 | November     | 2021-11-01 00:00:00.000 |             202111 |         47 | W47 2021    |            202147 | 2021-11-21 00:00:00.000 |              21 |   20211121 |              7 | Sunday     | Y         | Sun              |    4343 |           325 |          21 | FY22 | Nov    |              0 |             32 |               7 |           223 | Q4        |
| 2021-11-14 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          11 | November     | 2021-11-01 00:00:00.000 |             202111 |         46 | W46 2021    |            202146 | 2021-11-14 00:00:00.000 |              14 |   20211114 |              7 | Sunday     | Y         | Sun              |    4336 |           318 |          21 | FY22 | Nov    |              0 |             31 |               7 |           216 | Q4        |
| 2021-11-07 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          11 | November     | 2021-11-01 00:00:00.000 |             202111 |         45 | W45 2021    |            202145 | 2021-11-07 00:00:00.000 |               7 |   20211107 |              7 | Sunday     | Y         | Sun              |    4329 |           311 |          21 | FY22 | Nov    |              0 |             30 |               7 |           209 | Q4        |
| 2021-10-31 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          10 | October      | 2021-10-01 00:00:00.000 |             202110 |         44 | W44 2021    |            202144 | 2021-10-31 00:00:00.000 |              31 |   20211031 |              7 | Sunday     | Y         | Sun              |    4322 |           304 |          21 | FY22 | Oct    |              0 |             29 |               6 |           202 | Q4        |
| 2021-10-24 00:00:00.000 |   2021 |             4 | Q4 2021        |                20214 |          10 | October      | 2021-10-01 00:00:00.000 |             202110 |         43 | W43 2021    |            202143 | 2021-10-24 00:00:00.000 |              24 |   20211024 |              7 | Sunday     | Y         | Sun              |    4315 |           297 |          21 | FY22 | Oct    |              0 |             28 |               6 |           195 | Q4        |


Table: EA Customer
|   CustomerID | X3CustomerID   |
|-------------:|:---------------|
|       136433 |                |
|       136434 |                |
|       136435 |                |
|       136437 |                |
|       136438 |                |
|       136440 |                |
|       136443 |                |
|       136444 |                |
|       136446 |                |
|       136448 |                |


Table: EA SalesOrder
|   OrderID |   CustomerID | OrderDate               | OrderRemake   | Showroom   | Charge   |
|----------:|-------------:|:------------------------|:--------------|:-----------|:---------|
|    225916 |            5 | 2021-02-03 00:00:00.000 | False         | False      | True     |
|    227145 |            5 | 2021-02-15 00:00:00.000 | False         | False      | True     |
|    221802 |            5 | 2020-12-10 00:00:00.000 | False         | False      | True     |
|    221801 |            5 | 2020-12-10 00:00:00.000 | False         | False      | True     |
|    232519 |            5 | 2021-04-06 00:00:00.000 | False         | False      | True     |
|    232361 |            5 | 2021-04-01 00:00:00.000 | False         | False      | True     |
|    232247 |            5 | 2021-04-01 00:00:00.000 | False         | False      | True     |
|    232246 |            5 | 2021-04-01 00:00:00.000 | False         | False      | True     |
|    231998 |            5 | 2021-03-30 00:00:00.000 | False         | False      | True     |
|    231997 |            5 | 2021-03-30 00:00:00.000 | False         | False      | True     |


Table: Meaures
| Column   |
|----------|


Table: Sales
| Document_Number   |   Customer_Number | Document_Date           | Product_Dimension   | Hierarchy_1   | Hierarchy_2   |   Document Amount |
|:------------------|------------------:|:------------------------|:--------------------|:--------------|:--------------|------------------:|
| SIN0712UK0101525  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101501  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101498  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101494  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101491  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101493  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101525  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101501  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101499  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |
| SIN0712UK0101528  |                 5 | 2020-11-12 00:00:00.000 | Anciliaries Doors   | 5ANCILLS      | TOTAL         |                 0 |


Table: x3 customer
|   CustomerID |
|-------------:|
|       151677 |
|       151681 |
|       151684 |
|       151685 |
|        49665 |
|       145492 |
|       151671 |
|       151721 |
|       151686 |
|       151690 |


Table: X3 Orders
|   OrderNo |   BillToCustomer | OrderDate           | LastInvoiceNo   |
|----------:|-----------------:|:--------------------|:----------------|
|    232154 |                2 | 31/03/2021 00:00:00 |                 |
|    232096 |            67313 | 31/03/2021 00:00:00 |                 |
|    232188 |             1069 | 31/03/2021 00:00:00 |                 |
|    232187 |             1069 | 31/03/2021 00:00:00 |                 |
|    232120 |           108705 | 31/03/2021 00:00:00 |                 |
|    232160 |            38336 | 31/03/2021 00:00:00 |                 |
|    232227 |            40541 | 31/03/2021 00:00:00 |                 |
|    232231 |             1069 | 31/03/2021 00:00:00 |                 |
|    232150 |            26627 | 31/03/2021 00:00:00 |                 |
|    232148 |            88619 | 31/03/2021 00:00:00 |                 |

 


tables: name: Dates
data: Dates.csv
name: EA Customer
data: EA Customer.csv
name: EA SalesOrder
data: EA SalesOrder.csv
name: Meaures
data: Meaures.csv
name: Sales
data: Sales.csv
name: x3 customer
data: x3 customer.csv
name: X3 Orders
data: X3 Orders.csv
label: Sales
Document_Date
Dates
Date
X3 Orders
OrderDate
Dates
Date
EA SalesOrder
OrderDate
Dates
Date
EA SalesOrder
CustomerID
EA Customer
CustomerID
x3 customer
CustomerID
EA Customer
X3CustomerID
x3 customer
CustomerID
Sales
Customer_Number
output: {
    "joins": [
        {
            "from_table": "Sales",
            "from_column": "Document_Date",
            "to_table": "Dates",
            "to_column": "Date"
        },
        {
            "from_table": "X3 Orders",
            "from_column": "OrderDate",
            "to_table": "Dates",
            "to_column": "Date"
        },
        {
            "from_table": "EA SalesOrder",
            "from_column": "OrderDate",
            "to_table": "Dates",
            "to_column": "Date"
        },
        {
            "from_table": "EA SalesOrder",
            "from_column": "CustomerID",
            "to_table": "EA Customer",
            "to_column": "CustomerID"
        },
        {
            "from_table": "x3 customer",
            "from_column": "CustomerID",
            "to_table": "EA Customer",
            "to_column": "X3CustomerID"
        },
        {
            "from_table": "x3 customer",
            "from_column": "CustomerID",
            "to_table": "Sales",
            "to_column": "Customer_Number"
        }
    ]
}