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: Customer
|   Customer Id |   Age |   City Id | City   | State      | Name          |
|--------------:|------:|----------:|:-------|:-----------|:--------------|
|            42 |    40 |        34 | Fresno | California | Customer 42   |
|           132 |    33 |        34 | Fresno | California | Customer 132  |
|           378 |    34 |        34 | Fresno | California | Customer 378  |
|           403 |    36 |        34 | Fresno | California | Customer 403  |
|           501 |    37 |        34 | Fresno | California | Customer 501  |
|           535 |    32 |        34 | Fresno | California | Customer 535  |
|           562 |    31 |        34 | Fresno | California | Customer 562  |
|           724 |    34 |        34 | Fresno | California | Customer 724  |
|           986 |    31 |        34 | Fresno | California | Customer 986  |
|          1225 |    35 |        34 | Fresno | California | Customer 1225 |


Table: Date
| Date                    | Month-Year   | Month-Year Sort   |   Year |   Week Number | Week Start date         | Week End date           |   Week |   Week Rank |
|:------------------------|:-------------|:------------------|-------:|--------------:|:------------------------|:------------------------|-------:|------------:|
| 2016-01-01 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             1 |                         | 2016-01-02 00:00:00.000 | 201601 |           1 |
| 2016-01-02 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             1 |                         | 2016-01-02 00:00:00.000 | 201601 |           1 |
| 2016-01-03 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             2 | 2016-01-03 00:00:00.000 | 2016-01-09 00:00:00.000 | 201602 |           2 |
| 2016-01-04 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             2 | 2016-01-03 00:00:00.000 | 2016-01-09 00:00:00.000 | 201602 |           2 |
| 2016-01-05 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             2 | 2016-01-03 00:00:00.000 | 2016-01-09 00:00:00.000 | 201602 |           2 |
| 2016-01-06 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             2 | 2016-01-03 00:00:00.000 | 2016-01-09 00:00:00.000 | 201602 |           2 |
| 2016-01-07 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             2 | 2016-01-03 00:00:00.000 | 2016-01-09 00:00:00.000 | 201602 |           2 |
| 2016-01-08 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             2 | 2016-01-03 00:00:00.000 | 2016-01-09 00:00:00.000 | 201602 |           2 |
| 2016-01-09 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             2 | 2016-01-03 00:00:00.000 | 2016-01-09 00:00:00.000 | 201602 |           2 |
| 2016-01-10 00:00:00.000 | Jan-2016     | 2016-01           |   2016 |             3 | 2016-01-10 00:00:00.000 | 2016-01-16 00:00:00.000 | 201603 |           3 |


Table: Geography
|   City Id | City            | State        |
|----------:|:----------------|:-------------|
|         1 | New York        | New York     |
|         2 | Los Angeles     | California   |
|         3 | Chicago         | Illinois     |
|         4 | Houston         | Texas        |
|         5 | Phoenix         | Arizona      |
|         6 | Philadelphia[e] | Pennsylvania |
|         7 | San Antonio     | Texas        |
|         8 | San Diego       | California   |
|         9 | Dallas          | Texas        |
|        10 | San Jose        | California   |


Table: Item
|   Item Id | Name    |   Brand Id |   Category Id |   Sub Category Id | Brand    | Category   | Sub Category   |
|----------:|:--------|-----------:|--------------:|------------------:|:---------|:-----------|:---------------|
|         1 | Item 1  |         10 |             2 |                 6 | Brand 10 | Category 2 | Sub Cat 6      |
|         2 | Item 2  |          5 |             5 |                14 | Brand 5  | Category 5 | Sub Cat 14     |
|         3 | Item 3  |          9 |             2 |                 6 | Brand 9  | Category 2 | Sub Cat 6      |
|         4 | Item 4  |         12 |             2 |                 6 | Brand 12 | Category 2 | Sub Cat 6      |
|         5 | Item 5  |          7 |             2 |                 6 | Brand 7  | Category 2 | Sub Cat 6      |
|         6 | Item 6  |          7 |             3 |                17 | Brand 7  | Category 3 | Sub Cat 17     |
|         7 | Item 7  |          8 |             2 |                 5 | Brand 8  | Category 2 | Sub Cat 5      |
|         8 | Item 8  |         10 |             5 |                14 | Brand 10 | Category 5 | Sub Cat 14     |
|         9 | Item 9  |          7 |             4 |                19 | Brand 7  | Category 4 | Sub Cat 19     |
|        10 | Item 10 |          2 |             4 |                 2 | Brand 2  | Category 4 | Sub Cat 2      |


Table: Sales
|   Order No |   Item ID | Sales Date              | Delivery Date           |   Customer Id |   City Id |   Qty |   Price |   COGS Unit |   Discount Percent |   Gross Sales |   Discount |   Net Sales |   COGS |   Margin |   Delivery Days | First Sales Date        |   sales qty |
|-----------:|----------:|:------------------------|:------------------------|--------------:|----------:|------:|--------:|------------:|-------------------:|--------------:|-----------:|------------:|-------:|---------:|----------------:|:------------------------|------------:|
|         66 |        27 | 2017-11-13 00:00:00.000 | 2017-11-14 00:00:00.000 |           600 |        19 |     2 |      83 |          66 |                 35 |           166 |      58.1  |      107.9  |    132 |   -24.1  |               1 | 2017-01-27 00:00:00.000 |       49913 |
|         80 |        27 | 2017-02-17 00:00:00.000 | 2017-02-19 00:00:00.000 |          2445 |         9 |     2 |      83 |          66 |                 26 |           166 |      43.16 |      122.84 |    132 |    -9.16 |               2 |                         |       49913 |
|        221 |        27 | 2017-03-27 00:00:00.000 | 2017-03-31 00:00:00.000 |          1498 |        58 |     2 |      83 |          66 |                 29 |           166 |      48.14 |      117.86 |    132 |   -14.14 |               4 | 2017-02-19 00:00:00.000 |       49913 |
|        222 |        27 | 2017-07-29 00:00:00.000 | 2017-08-05 00:00:00.000 |          2256 |        31 |     2 |      83 |          66 |                 12 |           166 |      19.92 |      146.08 |    132 |    14.08 |               7 | 2017-02-19 00:00:00.000 |       49913 |
|        268 |        27 | 2017-08-01 00:00:00.000 | 2017-08-05 00:00:00.000 |           713 |        55 |     2 |      83 |          66 |                 19 |           166 |      31.54 |      134.46 |    132 |     2.46 |               4 |                         |       49913 |
|        344 |        27 | 2017-04-21 00:00:00.000 | 2017-04-28 00:00:00.000 |          2384 |         9 |     2 |      83 |          66 |                 24 |           166 |      39.84 |      126.16 |    132 |    -5.84 |               7 | 2017-02-16 00:00:00.000 |       49913 |
|        357 |        27 | 2017-04-12 00:00:00.000 | 2017-04-12 00:00:00.000 |          1879 |        62 |     2 |      83 |          66 |                 37 |           166 |      61.42 |      104.58 |    132 |   -27.42 |               0 | 2017-03-14 00:00:00.000 |       49913 |
|        370 |        27 | 2017-06-10 00:00:00.000 | 2017-06-15 00:00:00.000 |          2035 |        22 |     2 |      83 |          66 |                 39 |           166 |      64.74 |      101.26 |    132 |   -30.74 |               5 |                         |       49913 |
|        420 |        27 | 2017-05-17 00:00:00.000 | 2017-05-26 00:00:00.000 |           155 |        65 |     2 |      83 |          66 |                 32 |           166 |      53.12 |      112.88 |    132 |   -19.12 |               9 |                         |       49913 |
|        459 |        27 | 2017-01-11 00:00:00.000 | 2017-01-17 00:00:00.000 |          2545 |        45 |     2 |      83 |          66 |                 18 |           166 |      29.88 |      136.12 |    132 |     4.12 |               6 |                         |       49913 |

 


tables: name: Customer
data: Customer.csv
name: Date
data: Date.csv
name: Geography
data: Geography.csv
name: Item
data: Item.csv
name: Sales
data: Sales.csv
label: Sales
Customer Id
Customer
Customer Id
Sales
City Id
Geography
City Id
Sales
Item ID
Item
Item Id
output: {
    "joins": [
        {
            "from_table": "Sales",
            "from_column": "Customer Id",
            "to_table": "Customer",
            "to_column": "Customer Id"
        },
        {
            "from_table": "Sales",
            "from_column": "City Id",
            "to_table": "Geography",
            "to_column": "City Id"
        },
        {
            "from_table": "Sales",
            "from_column": "Item ID",
            "to_table": "Item",
            "to_column": "Item Id"
        }
    ]
}