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: sales customers (2)
| customer_code   | custmer_name            | customer_type   |
|:----------------|:------------------------|:----------------|
| Cus001          | Surge Stores            | Brick & Mortar  |
| Cus002          | Nomad Stores            | Brick & Mortar  |
| Cus003          | Excel Stores            | Brick & Mortar  |
| Cus004          | Surface Stores          | Brick & Mortar  |
| Cus005          | Premium Stores          | Brick & Mortar  |
| Cus006          | Electricalsara Stores   | Brick & Mortar  |
| Cus007          | Info Stores             | Brick & Mortar  |
| Cus008          | Acclaimed Stores        | Brick & Mortar  |
| Cus009          | Electricalsquipo Stores | Brick & Mortar  |
| Cus010          | Atlas Stores            | Brick & Mortar  |


Table: sales customers
| customer_code   | custmer_name            | customer_type   |
|:----------------|:------------------------|:----------------|
| Cus001          | Surge Stores            | Brick & Mortar  |
| Cus002          | Nomad Stores            | Brick & Mortar  |
| Cus003          | Excel Stores            | Brick & Mortar  |
| Cus004          | Surface Stores          | Brick & Mortar  |
| Cus005          | Premium Stores          | Brick & Mortar  |
| Cus006          | Electricalsara Stores   | Brick & Mortar  |
| Cus007          | Info Stores             | Brick & Mortar  |
| Cus008          | Acclaimed Stores        | Brick & Mortar  |
| Cus009          | Electricalsquipo Stores | Brick & Mortar  |
| Cus010          | Atlas Stores            | Brick & Mortar  |


Table: sales date (2)
| date                    | cy_date                 |   year | month_name   | date_yy_mmm   |
|:------------------------|:------------------------|-------:|:-------------|:--------------|
| 2018-01-01 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-02 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-03 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-04 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-05 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-06 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-07 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-08 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-09 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-10 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |


Table: sales date
| date                    | cy_date                 |   year | month_name   | date_yy_mmm   |
|:------------------------|:------------------------|-------:|:-------------|:--------------|
| 2018-01-01 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-02 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-03 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-04 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-05 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-06 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-07 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-08 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-09 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |
| 2018-01-10 00:00:00.000 | 2018-01-01 00:00:00.000 |   2018 | January      | 18-Jan        |


Table: sales markets (2)
| markets_code   | markets_name   | zone    |
|:---------------|:---------------|:--------|
| Mark001        | Chennai        | South   |
| Mark002        | Mumbai         | Central |
| Mark003        | Ahmedabad      | North   |
| Mark004        | Delhi NCR      | North   |
| Mark005        | Kanpur         | North   |
| Mark006        | Bengaluru      | South   |
| Mark007        | Bhopal         | Central |
| Mark008        | Lucknow        | North   |
| Mark009        | Patna          | North   |
| Mark010        | Kochi          | South   |


Table: sales markets
| markets_code   | markets_name   | zone    |
|:---------------|:---------------|:--------|
| Mark001        | Chennai        | South   |
| Mark002        | Mumbai         | Central |
| Mark003        | Ahmedabad      | North   |
| Mark004        | Delhi NCR      | North   |
| Mark005        | Kanpur         | North   |
| Mark006        | Bengaluru      | South   |
| Mark007        | Bhopal         | Central |
| Mark008        | Lucknow        | North   |
| Mark009        | Patna          | North   |
| Mark010        | Kochi          | South   |


Table: sales products (2)
| product_code   | product_type   |
|:---------------|:---------------|
| Prod001        | Own Brand      |
| Prod002        | Own Brand      |
| Prod003        | Own Brand      |
| Prod004        | Own Brand      |
| Prod005        | Own Brand      |
| Prod006        | Own Brand      |
| Prod007        | Own Brand      |
| Prod008        | Own Brand      |
| Prod009        | Own Brand      |
| Prod010        | Own Brand      |


Table: sales products
| product_code   | product_type   |
|:---------------|:---------------|
| Prod001        | Own Brand      |
| Prod002        | Own Brand      |
| Prod003        | Own Brand      |
| Prod004        | Own Brand      |
| Prod005        | Own Brand      |
| Prod006        | Own Brand      |
| Prod007        | Own Brand      |
| Prod008        | Own Brand      |
| Prod009        | Own Brand      |
| Prod010        | Own Brand      |


Table: sales transactions (2)
| product_code   | customer_code   | market_code   | order_date              |   sales_qty |   sales_amount | currency   |   profit_margin_percentage |   profit_margin |   cost_price |
|:---------------|:----------------|:--------------|:------------------------|------------:|---------------:|:-----------|---------------------------:|----------------:|-------------:|
| Prod279        | Cus020          | Mark011       | 2017-10-11 00:00:00.000 |           1 |            102 | INR        |                       0.39 |           39.78 |        62.22 |
| Prod279        | Cus020          | Mark011       | 2017-10-18 00:00:00.000 |           1 |            102 | INR        |                      -0.12 |          -12.24 |       114.24 |
| Prod279        | Cus020          | Mark011       | 2017-10-19 00:00:00.000 |           1 |            102 | INR        |                       0.29 |           29.58 |        72.42 |
| Prod279        | Cus020          | Mark011       | 2017-11-08 00:00:00.000 |           1 |            102 | INR        |                       0.36 |           36.72 |        65.28 |
| Prod279        | Cus020          | Mark011       | 2018-03-09 00:00:00.000 |           1 |            102 | INR        |                      -0.35 |          -35.7  |       137.7  |
| Prod279        | Cus020          | Mark011       | 2018-03-20 00:00:00.000 |           1 |            102 | INR        |                       0.26 |           26.52 |        75.48 |
| Prod279        | Cus020          | Mark011       | 2018-03-22 00:00:00.000 |           1 |            102 | INR        |                      -0.35 |          -35.7  |       137.7  |
| Prod279        | Cus020          | Mark011       | 2018-03-23 00:00:00.000 |           1 |            102 | INR        |                      -0.35 |          -35.7  |       137.7  |
| Prod279        | Cus020          | Mark011       | 2018-03-29 00:00:00.000 |           1 |            102 | INR        |                       0.34 |           34.68 |        67.32 |
| Prod279        | Cus020          | Mark011       | 2018-04-16 00:00:00.000 |           1 |            102 | INR        |                      -0.06 |           -6.12 |       108.12 |


Table: sales transactions
| product_code   | customer_code   | market_code   | order_date              |   sales_qty |   sales_amount | currency   |   Normalised_sales |
|:---------------|:----------------|:--------------|:------------------------|------------:|---------------:|:-----------|-------------------:|
| Prod279        | Cus020          | Mark011       | 2017-10-11 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2017-10-18 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2017-10-19 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2017-11-08 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2018-03-09 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2018-03-20 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2018-03-22 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2018-03-23 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2018-03-29 00:00:00.000 |           1 |            102 | INR        |                102 |
| Prod279        | Cus020          | Mark011       | 2018-04-16 00:00:00.000 |           1 |            102 | INR        |                102 |

 


tables: name: sales customers (2)
data: sales customers (2).csv
name: sales customers
data: sales customers.csv
name: sales date (2)
data: sales date (2).csv
name: sales date
data: sales date.csv
name: sales markets (2)
data: sales markets (2).csv
name: sales markets
data: sales markets.csv
name: sales products (2)
data: sales products (2).csv
name: sales products
data: sales products.csv
name: sales transactions (2)
data: sales transactions (2).csv
name: sales transactions
data: sales transactions.csv
label: sales transactions
customer_code
sales customers
customer_code
sales transactions
product_code
sales products
product_code
sales transactions
market_code
sales markets
markets_code
sales transactions
order_date
sales date
date
sales transactions (2)
customer_code
sales customers
customer_code
sales transactions
customer_code
sales customers (2)
customer_code
sales transactions (2)
customer_code
sales customers (2)
customer_code
sales transactions (2)
product_code
sales products
product_code
sales transactions
product_code
sales products (2)
product_code
sales transactions (2)
product_code
sales products (2)
product_code
output: {
    "joins": [
        {
            "from_table": "sales transactions",
            "from_column": "customer_code",
            "to_table": "sales customers",
            "to_column": "customer_code"
        },
        {
            "from_table": "sales transactions",
            "from_column": "product_code",
            "to_table": "sales products",
            "to_column": "product_code"
        },
        {
            "from_table": "sales transactions",
            "from_column": "market_code",
            "to_table": "sales markets",
            "to_column": "markets_code"
        },
        {
            "from_table": "sales transactions",
            "from_column": "order_date",
            "to_table": "sales date",
            "to_column": "date"
        },
        {
            "from_table": "sales transactions (2)",
            "from_column": "customer_code",
            "to_table": "sales customers",
            "to_column": "customer_code"
        },
        {
            "from_table": "sales transactions",
            "from_column": "customer_code",
            "to_table": "sales customers (2)",
            "to_column": "customer_code"
        },
        {
            "from_table": "sales transactions (2)",
            "from_column": "customer_code",
            "to_table": "sales customers (2)",
            "to_column": "customer_code"
        },
        {
            "from_table": "sales transactions (2)",
            "from_column": "product_code",
            "to_table": "sales products",
            "to_column": "product_code"
        },
        {
            "from_table": "sales transactions",
            "from_column": "product_code",
            "to_table": "sales products (2)",
            "to_column": "product_code"
        },
        {
            "from_table": "sales transactions (2)",
            "from_column": "product_code",
            "to_table": "sales products (2)",
            "to_column": "product_code"
        }
    ]
}