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: DIM_CUSTO
|   Preço Custo |
|--------------:|
|         34.36 |
|         29.46 |
|         37.79 |
|         13.53 |
|         35.73 |
|         28.39 |
|         25.15 |
|         24.1  |
|          9.16 |
|         27.18 |


Table: DIM_LUCRO
|   Margem Lucro |
|---------------:|
|       0.499927 |
|       0.450065 |
|       0.450007 |
|       0.5499   |
|       0.479988 |
|       0.470039 |
|       0.529907 |
|       0.530031 |
|       0.480136 |
|       0.469969 |


Table: DIM_PREPARACAO
|   Tempo Preparação (mins) |
|--------------------------:|
|                        11 |
|                        20 |
|                        23 |
|                        19 |
|                        22 |
|                        15 |
|                        16 |
|                        12 |
|                         9 |
|                        18 |


Table: DIM_PRODUTO
| Produto   |
|:----------|
| AX101     |
| BX102     |
| BX101     |
| AX103     |
| AX102     |
| DX101     |
| CX101     |
| DX103     |
| DX102     |
| BX103     |


Table: DIM_SERIAL
| Serial number   |
|:----------------|
| GF54309         |
| GF54425         |
| GF54381         |
| GF54527         |
| GF54695         |
| GF54484         |
| GF54240         |
| GF54584         |
| GF54319         |
| GF54236         |


Table: DIM_TEL
|   Duração Venda Telefone (mins) |
|--------------------------------:|
|                              17 |
|                              26 |
|                              27 |
|                               0 |
|                              33 |
|                               4 |
|                              19 |
|                              28 |
|                               3 |
|                              20 |


Table: DIM_TEMPO
| Data       | Data_C                  |
|:-----------|:------------------------|
| 19/03/2017 | 2017-03-19 00:00:00.000 |
| 27/02/2017 | 2017-02-27 00:00:00.000 |
| 2/3/2017   | 2017-03-02 00:00:00.000 |
| 28/03/2017 | 2017-03-28 00:00:00.000 |
| 3/3/2017   | 2017-03-03 00:00:00.000 |
| 5/3/2017   | 2017-03-05 00:00:00.000 |
| 6/3/2017   | 2017-03-06 00:00:00.000 |
| 27/03/2017 | 2017-03-27 00:00:00.000 |
| 7/3/2017   | 2017-03-07 00:00:00.000 |
| 25/03/2017 | 2017-03-25 00:00:00.000 |


Table: DIM_VENDA
|   Valor de Venda |
|-----------------:|
|            68.71 |
|            53.57 |
|            30.06 |
|            53.5  |
|            51.28 |
|            17.62 |
|            45.3  |
|            42.52 |
|            62.46 |
|            68.93 |


Table: TB_CUSTO
| Data       | Produto   | Serial number   |   Valor de Venda |   Preço Custo |   Duração Venda Telefone (mins) |   Tempo Preparação (mins) | Identificador   |   Margem Lucro |   Usei DAX |
|:-----------|:----------|:----------------|-----------------:|--------------:|--------------------------------:|--------------------------:|:----------------|---------------:|-----------:|
| 19/03/2017 | AX101     | GF54309         |            68.71 |         34.36 |                              17 |                        11 | AX101GF54309    |       0.499927 |   0.499927 |
| 27/02/2017 | BX102     | GF54425         |            53.57 |         29.46 |                              26 |                        11 | BX102GF54425    |       0.450065 |   0.450065 |
| 2/3/2017   | AX101     | GF54381         |            68.71 |         37.79 |                              27 |                        20 | AX101GF54381    |       0.450007 |   0.450007 |
| 28/03/2017 | BX101     | GF54527         |            30.06 |         13.53 |                              17 |                        23 | BX101GF54527    |       0.5499   |   0.5499   |
| 3/3/2017   | AX101     | GF54695         |            68.71 |         35.73 |                               0 |                        20 | AX101GF54695    |       0.479988 |   0.479988 |
| 19/03/2017 | BX102     | GF54484         |            53.57 |         28.39 |                              33 |                        19 | BX102GF54484    |       0.470039 |   0.470039 |
| 5/3/2017   | AX103     | GF54240         |            53.5  |         25.15 |                               4 |                        20 | AX103GF54240    |       0.529907 |   0.529907 |
| 27/02/2017 | AX102     | GF54584         |            51.28 |         24.1  |                              19 |                        11 | AX102GF54584    |       0.530031 |   0.530031 |
| 6/3/2017   | DX101     | GF54319         |            17.62 |          9.16 |                              28 |                        22 | DX101GF54319    |       0.480136 |   0.480136 |
| 27/03/2017 | AX102     | GF54236         |            51.28 |         27.18 |                               3 |                        15 | AX102GF54236    |       0.469969 |   0.469969 |

 


tables: name: DIM_CUSTO
data: DIM_CUSTO.csv
name: DIM_LUCRO
data: DIM_LUCRO.csv
name: DIM_PREPARACAO
data: DIM_PREPARACAO.csv
name: DIM_PRODUTO
data: DIM_PRODUTO.csv
name: DIM_SERIAL
data: DIM_SERIAL.csv
name: DIM_TEL
data: DIM_TEL.csv
name: DIM_TEMPO
data: DIM_TEMPO.csv
name: DIM_VENDA
data: DIM_VENDA.csv
name: TB_CUSTO
data: TB_CUSTO.csv
label: TB_CUSTO
Data
DIM_TEMPO
Data
TB_CUSTO
Produto
DIM_PRODUTO
Produto
TB_CUSTO
Serial number
DIM_SERIAL
Serial number
TB_CUSTO
Valor de Venda
DIM_VENDA
Valor de Venda
TB_CUSTO
Preço Custo
DIM_CUSTO
Preço Custo
TB_CUSTO
Duração Venda Telefone (mins)
DIM_TEL
Duração Venda Telefone (mins)
TB_CUSTO
Tempo Preparação (mins)
DIM_PREPARACAO
Tempo Preparação (mins)
TB_CUSTO
Margem Lucro
DIM_LUCRO
Margem Lucro
output: {
    "joins": [
        {
            "from_table": "TB_CUSTO",
            "from_column": "Data",
            "to_table": "DIM_TEMPO",
            "to_column": "Data"
        },
        {
            "from_table": "TB_CUSTO",
            "from_column": "Produto",
            "to_table": "DIM_PRODUTO",
            "to_column": "Produto"
        },
        {
            "from_table": "TB_CUSTO",
            "from_column": "Serial number",
            "to_table": "DIM_SERIAL",
            "to_column": "Serial number"
        },
        {
            "from_table": "TB_CUSTO",
            "from_column": "Valor de Venda",
            "to_table": "DIM_VENDA",
            "to_column": "Valor de Venda"
        },
        {
            "from_table": "TB_CUSTO",
            "from_column": "Pre\u00e7o Custo",
            "to_table": "DIM_CUSTO",
            "to_column": "Pre\u00e7o Custo"
        },
        {
            "from_table": "TB_CUSTO",
            "from_column": "Dura\u00e7\u00e3o Venda Telefone (mins)",
            "to_table": "DIM_TEL",
            "to_column": "Dura\u00e7\u00e3o Venda Telefone (mins)"
        },
        {
            "from_table": "TB_CUSTO",
            "from_column": "Tempo Prepara\u00e7\u00e3o (mins)",
            "to_table": "DIM_PREPARACAO",
            "to_column": "Tempo Prepara\u00e7\u00e3o (mins)"
        },
        {
            "from_table": "TB_CUSTO",
            "from_column": "Margem Lucro",
            "to_table": "DIM_LUCRO",
            "to_column": "Margem Lucro"
        }
    ]
}