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: d1
|   d1_id | d1_lbl   |   d1g2_id | d1_a1   |   d1_a2 |   d1_a3 |
|--------:|:---------|----------:|:--------|--------:|--------:|
|       1 | d1_v1    |         1 | a       |       1 |      50 |
|       2 | d1_v2    |         2 | b       |       2 |      89 |
|       3 | d1_v3    |         3 | c       |       3 |      37 |
|       4 | d1_v4    |         4 | b       |       2 |      71 |
|       5 | d1_v5    |         5 | c       |       3 |      80 |
|       6 | d1_v6    |         6 | d       |       4 |      48 |
|       7 | d1_v7    |         7 | c       |       3 |      23 |
|       8 | d1_v8    |         1 | d       |       4 |      13 |
|       9 | d1_v9    |         2 | e       |       4 |      45 |
|      10 | d1_v10   |         3 | d       |       1 |      36 |


Table: d1g1
|   d1g1_id | d1g1_lbl   |
|----------:|:-----------|
|         1 | d1g1_v1    |
|         2 | d1g1_v2    |
|         3 | d1g1_v3    |


Table: d1g2
|   d1g2_id | d1g2_lbl   |   d1g1_id |
|----------:|:-----------|----------:|
|         1 | d1g2_v1    |         1 |
|         2 | d1g2_v2    |         1 |
|         3 | d1g2_v3    |         1 |
|         4 | d1g2_v4    |         2 |
|         5 | d1g2_v5    |         2 |
|         6 | d1g2_v6    |         3 |
|         7 | d1g2_v7    |         3 |


Table: d2
|   d2_id | d2_lbl   |   d2g1_id |
|--------:|:---------|----------:|
|       1 | d2_v1    |         1 |
|       2 | d2_v2    |         2 |
|       3 | d2_v3    |         1 |
|       4 | d2_v4    |         2 |
|       5 | d2_v5    |         1 |
|       6 | d2_v6    |         2 |


Table: d2g1
|   d2g1_id | d2g1_lbl   |
|----------:|:-----------|
|         1 | d2g1_v1    |
|         2 | d2g1_v2    |


Table: f1
|   d1_id |   d2_id |   m1 |   m2 |   m3 | m4   |   f1_id |
|--------:|--------:|-----:|-----:|-----:|:-----|--------:|
|       1 |       1 |   10 |   20 |   30 | a    |       1 |
|       2 |       2 |   10 |   20 |   30 | a    |       2 |
|       3 |       3 |   10 |   20 |   30 | a    |       3 |
|       4 |       4 |   10 |   20 |   30 | d    |       4 |
|       5 |       5 |   10 |   20 |   30 | d    |       5 |
|       6 |       6 |   10 |   20 |   30 | d    |       6 |
|       7 |       1 |   10 |   20 |   30 | e    |       7 |
|       8 |       2 |   10 |   20 |   30 | d    |       8 |
|       9 |       3 |   10 |   20 |   30 | b    |       9 |
|      10 |       4 |   10 |   20 |   30 | b    |      10 |


Table: f2
|   time_date_id |   d1_id |   d2_id |   m1 |   m2 |   m3 | m4   |   f1_id |
|---------------:|--------:|--------:|-----:|-----:|-----:|:-----|--------:|
|       20070702 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070703 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070704 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070705 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070706 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070709 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070710 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070711 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070712 |       9 |       3 |   10 |   20 |   30 | b    |       9 |
|       20070713 |       9 |       3 |   10 |   20 |   30 | b    |       9 |


Table: f3
|   time_cmon_id |   d1_id |   d2_id |   m1 |   m2 |   m3 | m4   |   m100 |   f1_id |
|---------------:|--------:|--------:|-----:|-----:|-----:|:-----|-------:|--------:|
|         200701 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200702 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200703 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200704 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200705 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200706 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200707 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200708 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200709 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |
|         200710 |       9 |       3 |   10 |   20 |   30 | b    |     60 |       9 |


Table: time_date
|   time_date_id | time_date               |   dow_num | dow_name   | working_day   |   is_holiday | holiday_name   | europe_season   | north_america_season   | asia_season   |   time_cy_id | cy_lbl   |   time_cqtr_id | cqtr_lbl   |   cqtr_num | cqtr_name   |   time_cmon_id | cmon_lbl                |   cmon_num | cmon_name   |   time_fy_id | fy_lbl   |   time_fqtr_id | fqtr_lbl   |   fqtr_num | fqtr_name   |   time_fmon_id |   fmon_num | fmon_name   |
|---------------:|:------------------------|----------:|:-----------|:--------------|-------------:|:---------------|:----------------|:-----------------------|:--------------|-------------:|:---------|---------------:|:-----------|-----------:|:------------|---------------:|:------------------------|-----------:|:------------|-------------:|:---------|---------------:|:-----------|-----------:|:------------|---------------:|-----------:|:------------|
|       20050701 | 2005-07-01 00:00:00.000 |         6 | Friday     | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050704 | 2005-07-04 00:00:00.000 |         2 | Monday     | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050705 | 2005-07-05 00:00:00.000 |         3 | Tuesday    | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050706 | 2005-07-06 00:00:00.000 |         4 | Wednesday  | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050707 | 2005-07-07 00:00:00.000 |         5 | Thursday   | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050708 | 2005-07-08 00:00:00.000 |         6 | Friday     | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050711 | 2005-07-11 00:00:00.000 |         2 | Monday     | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050712 | 2005-07-12 00:00:00.000 |         3 | Tuesday    | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050713 | 2005-07-13 00:00:00.000 |         4 | Wednesday  | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |
|       20050714 | 2005-07-14 00:00:00.000 |         5 | Thursday   | WorkDay       |            0 | None           | Back to School  | Back to School         | None          |         2005 | CY 2005  |          20053 | Q3-2005    |          3 | Q3          |         200507 | 2005-07-01 00:00:00.000 |          7 | July        |         2006 | FY 2006  |          20061 | Q1-2006    |          1 | Q1          |         200601 |          1 | July        |


Table: time_month
|   time_cmon_id | cmon_lbl                | cmon_name   |   cmon_num |   time_cqtr_id | cqtr_lbl   | cqtr_name   |   cqtr_num |   time_cy_id | cy_lbl   |   time_fmon_id | fmon_name   |   fmon_num |   time_fqtr_id | fqtr_lbl   | fqtr_name   |   fqtr_num |   time_fy_id | fy_lbl   |
|---------------:|:------------------------|:------------|-----------:|---------------:|:-----------|:------------|-----------:|-------------:|:---------|---------------:|:------------|-----------:|---------------:|:-----------|:------------|-----------:|-------------:|:---------|
|         200507 | 2005-07-01 00:00:00.000 | July        |          7 |          20053 | Q3-2005    | Q3          |          3 |         2005 | CY 2005  |         200601 | July        |          1 |          20061 | Q1-2006    | Q1          |          1 |         2006 | FY 2006  |
|         200607 | 2006-07-01 00:00:00.000 | July        |          7 |          20063 | Q3-2006    | Q3          |          3 |         2006 | CY 2006  |         200701 | July        |          1 |          20071 | Q1-2007    | Q1          |          1 |         2007 | FY 2007  |
|         200707 | 2007-07-01 00:00:00.000 | July        |          7 |          20073 | Q3-2007    | Q3          |          3 |         2007 | CY 2007  |         200801 | July        |          1 |          20081 | Q1-2008    | Q1          |          1 |         2008 | FY 2008  |
|         200807 | 2008-07-01 00:00:00.000 | July        |          7 |          20083 | Q3-2008    | Q3          |          3 |         2008 | CY 2008  |         200901 | July        |          1 |          20091 | Q1-2009    | Q1          |          1 |         2009 | FY 2009  |
|         200907 | 2009-07-01 00:00:00.000 | July        |          7 |          20093 | Q3-2009    | Q3          |          3 |         2009 | CY 2009  |         201001 | July        |          1 |          20101 | Q1-2010    | Q1          |          1 |         2010 | FY 2010  |
|         201007 | 2010-07-01 00:00:00.000 | July        |          7 |          20103 | Q3-2010    | Q3          |          3 |         2010 | CY 2010  |         201101 | July        |          1 |          20111 | Q1-2011    | Q1          |          1 |         2011 | FY 2011  |
|         201107 | 2011-07-01 00:00:00.000 | July        |          7 |          20113 | Q3-2011    | Q3          |          3 |         2011 | CY 2011  |         201201 | July        |          1 |          20121 | Q1-2012    | Q1          |          1 |         2012 | FY 2012  |
|         200508 | 2005-08-01 00:00:00.000 | August      |          8 |          20053 | Q3-2005    | Q3          |          3 |         2005 | CY 2005  |         200602 | August      |          2 |          20061 | Q1-2006    | Q1          |          1 |         2006 | FY 2006  |
|         200608 | 2006-08-01 00:00:00.000 | August      |          8 |          20063 | Q3-2006    | Q3          |          3 |         2006 | CY 2006  |         200702 | August      |          2 |          20071 | Q1-2007    | Q1          |          1 |         2007 | FY 2007  |
|         200708 | 2007-08-01 00:00:00.000 | August      |          8 |          20073 | Q3-2007    | Q3          |          3 |         2007 | CY 2007  |         200802 | August      |          2 |          20081 | Q1-2008    | Q1          |          1 |         2008 | FY 2008  |

 


tables: name: d1
data: d1.csv
name: d1g1
data: d1g1.csv
name: d1g2
data: d1g2.csv
name: d2
data: d2.csv
name: d2g1
data: d2g1.csv
name: f1
data: f1.csv
name: f2
data: f2.csv
name: f3
data: f3.csv
name: time_date
data: time_date.csv
name: time_month
data: time_month.csv
label: f1
d1_id
d1
d1_id
d1
d1g2_id
d1g2
d1g2_id
d1g2
d1g1_id
d1g1
d1g1_id
f1
d2_id
d2
d2_id
d2
d2g1_id
d2g1
d2g1_id
f2
d1_id
d1
d1_id
f3
d1_id
d1
d1_id
f2
d2_id
d2
d2_id
f3
d2_id
d2
d2_id
f2
time_date_id
time_date
time_date_id
output: {
    "joins": [
        {
            "from_table": "f1",
            "from_column": "d1_id",
            "to_table": "d1",
            "to_column": "d1_id"
        },
        {
            "from_table": "d1",
            "from_column": "d1g2_id",
            "to_table": "d1g2",
            "to_column": "d1g2_id"
        },
        {
            "from_table": "d1g2",
            "from_column": "d1g1_id",
            "to_table": "d1g1",
            "to_column": "d1g1_id"
        },
        {
            "from_table": "f1",
            "from_column": "d2_id",
            "to_table": "d2",
            "to_column": "d2_id"
        },
        {
            "from_table": "d2",
            "from_column": "d2g1_id",
            "to_table": "d2g1",
            "to_column": "d2g1_id"
        },
        {
            "from_table": "f2",
            "from_column": "d1_id",
            "to_table": "d1",
            "to_column": "d1_id"
        },
        {
            "from_table": "f3",
            "from_column": "d1_id",
            "to_table": "d1",
            "to_column": "d1_id"
        },
        {
            "from_table": "f2",
            "from_column": "d2_id",
            "to_table": "d2",
            "to_column": "d2_id"
        },
        {
            "from_table": "f3",
            "from_column": "d2_id",
            "to_table": "d2",
            "to_column": "d2_id"
        },
        {
            "from_table": "f2",
            "from_column": "time_date_id",
            "to_table": "time_date",
            "to_column": "time_date_id"
        }
    ]
}