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: DimDate
| Date                    |   Year | Month Name   |   Quarter |   Fiscal year |   Fiscal Period |   Fiscal Quarter |
|:------------------------|-------:|:-------------|----------:|--------------:|----------------:|-----------------:|
| 2007-07-01 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-02 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-03 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-04 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-05 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-06 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-07 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-08 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-09 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |
| 2007-07-10 00:00:00.000 |   2007 | July         |         3 |          2008 |               4 |                2 |


Table: Measures table



Table: Product Vendor
|   ProductID |   BusinessEntityID |   AverageLeadTime |   StandardPrice |   LastReceiptCost | LastReceiptDate         |   MinOrderQty |   MaxOrderQty | OnOrderQty   | UnitMeasureCode   |
|------------:|-------------------:|------------------:|----------------:|------------------:|:------------------------|--------------:|--------------:|:-------------|:------------------|
|         375 |               1562 |                16 |           41.21 |           43.2705 | 2006-09-10 00:00:00.000 |             1 |             5 |              | CTN               |
|         375 |               1656 |                16 |           41.21 |           43.2705 | 2006-08-29 00:00:00.000 |             1 |             5 |              | CTN               |
|         376 |               1562 |                16 |           39.21 |           41.1705 | 2006-09-10 00:00:00.000 |             1 |             5 |              | CTN               |
|         376 |               1656 |                16 |           45.28 |           47.544  | 2006-08-29 00:00:00.000 |             1 |             5 |              | CTN               |
|         377 |               1562 |                16 |           43.28 |           45.444  | 2006-09-17 00:00:00.000 |             1 |             5 |              | CTN               |
|         377 |               1656 |                16 |           41.21 |           43.2705 | 2006-09-04 00:00:00.000 |             1 |             5 |              | CTN               |
|         378 |               1562 |                16 |           39.21 |           41.1705 | 2006-09-17 00:00:00.000 |             1 |             5 |              | CTN               |
|         378 |               1656 |                16 |           39.21 |           41.1705 | 2006-09-04 00:00:00.000 |             1 |             5 |              | CTN               |
|         379 |               1562 |                16 |           37.21 |           39.0705 | 2006-09-17 00:00:00.000 |             1 |             5 |              | CTN               |
|         379 |               1656 |                16 |           43.28 |           45.444  | 2006-09-04 00:00:00.000 |             1 |             5 |              | CTN               |


Table: Product
|   ProductID | Name          | ProductNumber   | MakeFlag   | FinishedGoodsFlag   | Color   |   SafetyStockLevel |   ReorderPoint |   StandardCost |   ListPrice | Size   | SizeUnitMeasureCode   | WeightUnitMeasureCode   | Weight   |   DaysToManufacture | ProductLine   | Class   | Style   | ProductSubcategoryID   | ProductModelID   | SellStartDate           | SellEndDate   | DiscontinuedDate   |
|------------:|:--------------|:----------------|:-----------|:--------------------|:--------|-------------------:|---------------:|---------------:|------------:|:-------|:----------------------|:------------------------|:---------|--------------------:|:--------------|:--------|:--------|:-----------------------|:-----------------|:------------------------|:--------------|:-------------------|
|         323 | Crown Race    | CR-9981         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         325 | Decal 1       | DC-8732         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         326 | Decal 2       | DC-9824         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         341 | Flat Washer 1 | FW-1000         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         342 | Flat Washer 6 | FW-1200         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         343 | Flat Washer 2 | FW-1400         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         344 | Flat Washer 9 | FW-3400         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         345 | Flat Washer 4 | FW-3800         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         346 | Flat Washer 3 | FW-5160         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |
|         347 | Flat Washer 8 | FW-5800         | False      | False               |         |               1000 |            750 |              0 |           0 |        |                       |                         |          |                   0 |               |         |         |                        |                  | 1999-06-01 00:00:00.000 |               |                    |


Table: Sales Order Detail
|   SalesOrderID |   SalesOrderDetailID |   ProductID |   SpecialOfferID |   UnitPrice |   OrderQty |   UnitPriceDiscount | CarrierTrackingNumber   | DueDate                 | ShipDate                |
|---------------:|---------------------:|------------:|-----------------:|------------:|-----------:|--------------------:|:------------------------|:------------------------|:------------------------|
|          51178 |                37753 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-25 00:00:00.000 | 2008-07-20 00:00:00.000 |
|          51180 |                37760 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-02 00:00:00.000 | 2008-07-02 00:00:00.000 |
|          51191 |                37790 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-05 00:00:00.000 | 2008-06-30 00:00:00.000 |
|          51196 |                37804 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-15 00:00:00.000 | 2008-07-15 00:00:00.000 |
|          51197 |                37809 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-23 00:00:00.000 | 2008-07-24 00:00:00.000 |
|          51198 |                37813 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-14 00:00:00.000 | 2008-07-10 00:00:00.000 |
|          51199 |                37817 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-09 00:00:00.000 | 2008-07-05 00:00:00.000 |
|          51203 |                37826 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-05 00:00:00.000 | 2008-07-04 00:00:00.000 |
|          51205 |                37830 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-09 00:00:00.000 | 2008-07-04 00:00:00.000 |
|          51206 |                37834 |         870 |                1 |        4.99 |          1 |                   0 |                         | 2008-07-19 00:00:00.000 | 2008-07-19 00:00:00.000 |


Table: Sales Order Header
|   SalesOrderID |   RevisionNumber | OrderDate               |   Status | OnlineOrderFlag   | SalesOrderNumber   | PurchaseOrderNumber   | AccountNumber   |   CustomerID |   TerritoryID |   BillToAddressID |   ShipToAddressID |   ShipMethodID |   TaxAmt |   Freight | LocalCurrency   |
|---------------:|-----------------:|:------------------------|---------:|:------------------|:-------------------|:----------------------|:----------------|-------------:|--------------:|------------------:|------------------:|---------------:|---------:|----------:|:----------------|
|          43702 |                1 | 2006-07-02 00:00:00.000 |        5 | True              | SO43702            |                       | 10-4030-027645  |        27645 |             4 |             22584 |             22584 |              1 |  286.262 |   89.4568 | USD             |
|          43706 |                1 | 2006-07-03 00:00:00.000 |        5 | True              | SO43706            |                       | 10-4030-027621  |        27621 |             4 |             13264 |             13264 |              1 |  286.262 |   89.4568 | USD             |
|          43707 |                1 | 2006-07-03 00:00:00.000 |        5 | True              | SO43707            |                       | 10-4030-027616  |        27616 |             4 |             20923 |             20923 |              1 |  286.262 |   89.4568 | USD             |
|          43713 |                1 | 2006-07-05 00:00:00.000 |        5 | True              | SO43713            |                       | 10-4030-027601  |        27601 |             4 |             11855 |             11855 |              1 |  286.262 |   89.4568 | USD             |
|          43719 |                1 | 2006-07-06 00:00:00.000 |        5 | True              | SO43719            |                       | 10-4030-027612  |        27612 |             4 |             13854 |             13854 |              1 |  286.262 |   89.4568 | USD             |
|          43728 |                1 | 2006-07-09 00:00:00.000 |        5 | True              | SO43728            |                       | 10-4030-027666  |        27666 |             4 |             20616 |             20616 |              1 |  286.262 |   89.4568 | USD             |
|          43747 |                1 | 2006-07-14 00:00:00.000 |        5 | True              | SO43747            |                       | 10-4030-027623  |        27623 |             4 |             27241 |             27241 |              1 |  286.262 |   89.4568 | USD             |
|          43755 |                1 | 2006-07-15 00:00:00.000 |        5 | True              | SO43755            |                       | 10-4030-027670  |        27670 |             4 |             21785 |             21785 |              1 |  286.262 |   89.4568 | USD             |
|          43758 |                1 | 2006-07-16 00:00:00.000 |        5 | True              | SO43758            |                       | 10-4030-027646  |        27646 |             4 |             14400 |             14400 |              1 |  286.262 |   89.4568 | USD             |
|          43762 |                1 | 2006-07-17 00:00:00.000 |        5 | True              | SO43762            |                       | 10-4030-027578  |        27578 |             4 |             19011 |             19011 |              1 |  286.262 |   89.4568 | USD             |


Table: Sales Territory
|   TerritoryID | Location       | CountryRegionCode   | Group         |
|--------------:|:---------------|:--------------------|:--------------|
|             1 | Northwest      | US                  | North America |
|             2 | Northeast      | US                  | North America |
|             3 | Central        | US                  | North America |
|             4 | Southwest      | US                  | North America |
|             5 | Southeast      | US                  | North America |
|             6 | Canada         | CA                  | North America |
|             7 | France         | FR                  | Europe        |
|             8 | Germany        | DE                  | Europe        |
|             9 | Australia      | AU                  | Pacific       |
|            10 | United Kingdom | GB                  | Europe        |


Table: Sales Territoty History
|   BusinessEntityID |   TerritoryID | StartDate               | EndDate                 |
|-------------------:|--------------:|:------------------------|:------------------------|
|                275 |             2 | 2006-07-01 00:00:00.000 | 2007-12-31 00:00:00.000 |
|                275 |             3 | 2008-01-01 00:00:00.000 |                         |
|                276 |             4 | 2006-07-01 00:00:00.000 |                         |
|                277 |             2 | 2008-01-01 00:00:00.000 |                         |
|                277 |             3 | 2006-07-01 00:00:00.000 | 2007-12-31 00:00:00.000 |
|                279 |             5 | 2006-07-01 00:00:00.000 |                         |
|                280 |             1 | 2006-07-01 00:00:00.000 | 2007-10-31 00:00:00.000 |
|                282 |             6 | 2006-07-01 00:00:00.000 | 2007-06-30 00:00:00.000 |
|                282 |            10 | 2007-07-01 00:00:00.000 |                         |
|                284 |             1 | 2007-11-01 00:00:00.000 |                         |

 


tables: name: DimDate
data: DimDate.csv
name: Measures table
data: Measures table.csv
name: Product Vendor
data: Product Vendor.csv
name: Product
data: Product.csv
name: Sales Order Detail
data: Sales Order Detail.csv
name: Sales Order Header
data: Sales Order Header.csv
name: Sales Territory
data: Sales Territory.csv
name: Sales Territoty History
data: Sales Territoty History.csv
label: Sales Order Detail
ProductID
Product
ProductID
Product Vendor
ProductID
Product
ProductID
Sales Order Detail
ShipDate
DimDate
Date
Sales Order Detail
SalesOrderID
Sales Order Header
SalesOrderID
Sales Territoty History
TerritoryID
Sales Territory
TerritoryID
Sales Order Header
TerritoryID
Sales Territory
TerritoryID
output: {
    "joins": [
        {
            "from_table": "Sales Order Detail",
            "from_column": "ProductID",
            "to_table": "Product",
            "to_column": "ProductID"
        },
        {
            "from_table": "Product Vendor",
            "from_column": "ProductID",
            "to_table": "Product",
            "to_column": "ProductID"
        },
        {
            "from_table": "Sales Order Detail",
            "from_column": "ShipDate",
            "to_table": "DimDate",
            "to_column": "Date"
        },
        {
            "from_table": "Sales Order Detail",
            "from_column": "SalesOrderID",
            "to_table": "Sales Order Header",
            "to_column": "SalesOrderID"
        },
        {
            "from_table": "Sales Territoty History",
            "from_column": "TerritoryID",
            "to_table": "Sales Territory",
            "to_column": "TerritoryID"
        },
        {
            "from_table": "Sales Order Header",
            "from_column": "TerritoryID",
            "to_table": "Sales Territory",
            "to_column": "TerritoryID"
        }
    ]
}