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: Calendar
| Date                    |   Year | Quarter   | Month    | MonthSort   | Month in Year   |   MonthInYearSort | Day of Week   |   DayOfWeekSort |
|:------------------------|-------:|:----------|:---------|:------------|:----------------|------------------:|:--------------|----------------:|
| 2012-01-01 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Sun           |               7 |
| 2012-01-02 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Mon           |               1 |
| 2012-01-03 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Tue           |               2 |
| 2012-01-04 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Wed           |               3 |
| 2012-01-05 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Thu           |               4 |
| 2012-01-06 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Fri           |               5 |
| 2012-01-07 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Sat           |               6 |
| 2012-01-08 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Sun           |               7 |
| 2012-01-09 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Mon           |               1 |
| 2012-01-10 00:00:00.000 |   2012 | 2012-Q1   | Jan 2012 | 2012-01     | Jan             |                 1 | Tue           |               2 |


Table: Customers
|   CustomerId | City Name   | State   |   Zipcode | Gender   | BirthDate               | Customer         | Customer Type     |   Age | Age Group        | Sales Region   | State Name   |   SalesRegionSort | City         |
|-------------:|:------------|:--------|----------:|:---------|:------------------------|:-----------------|:------------------|------:|:-----------------|:---------------|:-------------|------------------:|:-------------|
|          760 | San Jose    | CA      |     95133 | Female   | 1968-03-16 00:00:00.000 | Lucile Blake     | One-time Customer |    54 | Ages 50 TO 65    | Western Region | California   |                 1 | San Jose, CA |
|          881 | San Jose    | CA      |     95133 | Female   | 1942-07-19 00:00:00.000 | Rochelle Owen    | One-time Customer |    80 | Ages 65 and over | Western Region | California   |                 1 | San Jose, CA |
|          940 | San Jose    | CA      |     95133 | Female   | 1943-03-07 00:00:00.000 | Corinne Finch    | One-time Customer |    79 | Ages 65 and over | Western Region | California   |                 1 | San Jose, CA |
|         1119 | San Jose    | CA      |     95133 | Female   | 1990-09-03 00:00:00.000 | Twila Massey     | One-time Customer |    31 | Ages 30 TO 39    | Western Region | California   |                 1 | San Jose, CA |
|         1548 | San Jose    | CA      |     95133 | Female   | 1955-07-14 00:00:00.000 | Kellie Yang      | One-time Customer |    67 | Ages 65 and over | Western Region | California   |                 1 | San Jose, CA |
|         2195 | San Jose    | CA      |     95133 | Female   | 1951-03-25 00:00:00.000 | Megan Martin     | One-time Customer |    71 | Ages 65 and over | Western Region | California   |                 1 | San Jose, CA |
|         2252 | San Jose    | CA      |     95133 | Female   | 1946-04-03 00:00:00.000 | Cynthia Blake    | One-time Customer |    76 | Ages 65 and over | Western Region | California   |                 1 | San Jose, CA |
|         2341 | San Jose    | CA      |     95133 | Female   | 1960-05-02 00:00:00.000 | Karyn Hodges     | One-time Customer |    62 | Ages 50 TO 65    | Western Region | California   |                 1 | San Jose, CA |
|         2368 | San Jose    | CA      |     95133 | Female   | 1948-05-26 00:00:00.000 | Priscilla Potter | One-time Customer |    74 | Ages 65 and over | Western Region | California   |                 1 | San Jose, CA |
|         2525 | San Jose    | CA      |     95133 | Female   | 1949-11-10 00:00:00.000 | Nadia Gray       | One-time Customer |    72 | Ages 65 and over | Western Region | California   |                 1 | San Jose, CA |


Table: Products
|   ProductId | Product                            |   UnitCost |   ListPrice | Product Image                                                 | Category       | Subcategory       |
|------------:|:-----------------------------------|-----------:|------------:|:--------------------------------------------------------------|:---------------|:------------------|
|           1 | Batman Action Figure               |       6.85 |       14.95 | http://classresources.blob.core.windows.net/images/WP0001.jpg | Action Figures | Tough Guys        |
|           2 | Captain America Action Figure      |       7.05 |       12.95 | http://classresources.blob.core.windows.net/images/WP0002.jpg | Action Figures | Tough Guys        |
|           3 | GI Joe Action Figure               |       6.1  |       14.95 | http://classresources.blob.core.windows.net/images/WP0003.jpg | Action Figures | Tough Guys        |
|           4 | Green Hulk Action Figure           |       2.85 |        9.95 | http://classresources.blob.core.windows.net/images/WP0004.jpg | Action Figures | Tough Guys        |
|           5 | Red Hulk Alter Ego Action Figure   |       2.85 |        9.95 | http://classresources.blob.core.windows.net/images/WP0005.jpg | Action Figures | Tough Guys        |
|           6 | Godzilla Action Figure             |      14.25 |       19.95 | http://classresources.blob.core.windows.net/images/WP0006.jpg | Action Figures | Tough Guys        |
|           7 | Perry the Platypus Action Figure   |      12    |       21.95 | http://classresources.blob.core.windows.net/images/WP0007.jpg | Action Figures | Cute and Huggable |
|           8 | Green Angry Bird Action Figure     |       2.1  |        4.95 | http://classresources.blob.core.windows.net/images/WP0008.jpg | Action Figures | Cute and Huggable |
|           9 | Red Angry Bird Action Figure       |       2.1  |       14.95 | http://classresources.blob.core.windows.net/images/WP0009.jpg | Action Figures | Cute and Huggable |
|          10 | Phineas and Ferb Action Figure Set |      12.25 |       19.95 | http://classresources.blob.core.windows.net/images/WP0010.jpg | Action Figures | Cute and Huggable |


Table: Purchases
|   InvoiceId | Purchase Type   | InvoiceDate             |   InvoiceAmount |
|------------:|:----------------|:------------------------|----------------:|
|         273 | Store Purchase  | 2012-03-07 00:00:00.000 |           119.7 |
|        1112 | Store Purchase  | 2012-05-24 00:00:00.000 |           119.7 |
|        1699 | Store Purchase  | 2012-06-16 00:00:00.000 |           119.7 |
|        1742 | Store Purchase  | 2012-06-19 00:00:00.000 |           119.7 |
|        1983 | Store Purchase  | 2012-06-27 00:00:00.000 |           119.7 |
|        2324 | Store Purchase  | 2012-07-09 00:00:00.000 |           119.7 |
|        2343 | Store Purchase  | 2012-07-10 00:00:00.000 |           119.7 |
|        3327 | Store Purchase  | 2012-08-14 00:00:00.000 |           119.7 |
|        3489 | Store Purchase  | 2012-08-19 00:00:00.000 |           119.7 |
|        3904 | Store Purchase  | 2012-08-29 00:00:00.000 |           119.7 |


Table: Sales Regions
| State   | State Name   | Sales Region   |
|:--------|:-------------|:---------------|
| AK      | Alaska       | Western Region |
| AL      | Alabama      | Central Region |
| AR      | Arkansas     | Central Region |
| AZ      | Arizona      | Western Region |
| CA      | California   | Western Region |
| CO      | Colorado     | Western Region |
| CT      | Connecticut  | Eastern Region |
| DE      | Delaware     | Eastern Region |
| FL      | Florida      | Eastern Region |
| GA      | Georgia      | Eastern Region |


Table: Sales
|   Id |   Quantity |   SalesAmount |   InvoiceId |   ProductId | PurchaseDate            |   CustomerId |   ProductCost |   SalesProfit |   PurchaseYear | Invoice Number   |
|-----:|-----------:|--------------:|------------:|------------:|:------------------------|-------------:|--------------:|--------------:|---------------:|:-----------------|
|   95 |          9 |        179.55 |          46 |           6 | 2012-02-04 00:00:00.000 |           46 |        128.25 |          51.3 |           2012 | Invoice #46      |
|   96 |          9 |        179.55 |          47 |           6 | 2012-02-04 00:00:00.000 |           47 |        128.25 |          51.3 |           2012 | Invoice #47      |
|  307 |          9 |        179.55 |         155 |           6 | 2012-02-23 00:00:00.000 |          142 |        128.25 |          51.3 |           2012 | Invoice #155     |
|  313 |          9 |        179.55 |         157 |           6 | 2012-02-23 00:00:00.000 |          114 |        128.25 |          51.3 |           2012 | Invoice #157     |
|  357 |          9 |        179.55 |         180 |           6 | 2012-02-25 00:00:00.000 |          116 |        128.25 |          51.3 |           2012 | Invoice #180     |
|  601 |          9 |        179.55 |         296 |           6 | 2012-03-10 00:00:00.000 |          240 |        128.25 |          51.3 |           2012 | Invoice #296     |
|  617 |          9 |        179.55 |         306 |           6 | 2012-03-10 00:00:00.000 |          130 |        128.25 |          51.3 |           2012 | Invoice #306     |
|  761 |          9 |        179.55 |         378 |           6 | 2012-03-19 00:00:00.000 |          297 |        128.25 |          51.3 |           2012 | Invoice #378     |
|  861 |          9 |        179.55 |         427 |           6 | 2012-03-24 00:00:00.000 |          325 |        128.25 |          51.3 |           2012 | Invoice #427     |
|  863 |          9 |        179.55 |         428 |           6 | 2012-03-24 00:00:00.000 |          326 |        128.25 |          51.3 |           2012 | Invoice #428     |


Table: SalesRegionsSort
| Sales Region   |   SalesRegionSort |
|:---------------|------------------:|
| Western Region |                 1 |
| Central Region |                 2 |
| Eastern Region |                 3 |

 


tables: name: Calendar
data: Calendar.csv
name: Customers
data: Customers.csv
name: Products
data: Products.csv
name: Purchases
data: Purchases.csv
name: Sales Regions
data: Sales Regions.csv
name: Sales
data: Sales.csv
name: SalesRegionsSort
data: SalesRegionsSort.csv
label: Sales
InvoiceId
Purchases
InvoiceId
Sales
ProductId
Products
ProductId
Sales
CustomerId
Customers
CustomerId
output: {
    "joins": [
        {
            "from_table": "Sales",
            "from_column": "InvoiceId",
            "to_table": "Purchases",
            "to_column": "InvoiceId"
        },
        {
            "from_table": "Sales",
            "from_column": "ProductId",
            "to_table": "Products",
            "to_column": "ProductId"
        },
        {
            "from_table": "Sales",
            "from_column": "CustomerId",
            "to_table": "Customers",
            "to_column": "CustomerId"
        }
    ]
}