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: Dams_Muni
| name            | muni_name         |
|:----------------|:------------------|
| VOELVLEI        | Drakenstein       |
| HELY-HUTCHINSON | City of Cape Town |
| BERG RIVER      | Stellenbosch      |
| THEEWATERSKLOOF | Theewaterskloof   |
| KLEINPLAATS     | City of Cape Town |
| DE VILLIERS     | City of Cape Town |
| ALEXANDRA       | City of Cape Town |
| WOODHEAD        | City of Cape Town |
| LEWIS GAY       | City of Cape Town |
| STEENBRAS LOWER | City of Cape Town |


Table: Dam_levels
| Date                    |   Height_M |   Storage_ML |   Current | Dam      |   DamID |   Percentage |
|:------------------------|-----------:|-------------:|----------:|:---------|--------:|-------------:|
| 2012-01-01 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-02 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-03 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-04 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-05 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-06 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-07 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-08 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-09 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |
| 2012-01-10 00:00:00.000 |          0 |            0 |         0 | VICTORIA |      10 |            0 |


Table: Dam_Storage_Diff_between_dates
| Date                    | name     |   storage |   Diff_of_Storage_between_dates |
|:------------------------|:---------|----------:|--------------------------------:|
| 2012-01-02 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-03 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-04 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-05 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-06 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-07 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-08 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-09 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-10 00:00:00.000 | VICTORIA |         0 |                               0 |
| 2012-01-11 00:00:00.000 | VICTORIA |         0 |                               0 |


Table: DeltaStorage
| Date                    | DamName   |   StorageML |   Diff_of_Storage_between_dates |
|:------------------------|:----------|------------:|--------------------------------:|
| 2012-01-02 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-03 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-04 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-05 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-06 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-07 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-08 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-09 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-10 00:00:00.000 | VICTORIA  |           0 |                               0 |
| 2012-01-11 00:00:00.000 | VICTORIA  |           0 |                               0 |


Table: DemandConsumption
|   demand_consumption_id |   urban |   agri | date                    |   total_consumption |
|------------------------:|--------:|-------:|:------------------------|--------------------:|
|                       1 |     564 |      0 | 2018-10-01 00:00:00.000 |                 564 |
|                       2 |     520 |      0 | 2018-09-01 00:00:00.000 |                 520 |
|                       3 |     540 |      0 | 2018-08-01 00:00:00.000 |                 540 |
|                       4 |     527 |      0 | 2018-07-01 00:00:00.000 |                 527 |
|                       5 |     556 |      0 | 2018-06-01 00:00:00.000 |                 556 |
|                       6 |     563 |      0 | 2018-05-01 00:00:00.000 |                 563 |
|                       7 |     555 |      0 | 2018-04-01 00:00:00.000 |                 555 |
|                       8 |     571 |      0 | 2018-03-01 00:00:00.000 |                 571 |
|                       9 |     571 |      0 | 2018-02-01 00:00:00.000 |                 571 |
|                      10 |     638 |   1100 | 2018-01-01 00:00:00.000 |                1738 |


Table: df_locations
| name            |   latitude |   longitude | category   |   muni_id |
|:----------------|-----------:|------------:|:-----------|----------:|
| ALEXANDRA       |   -33.988  |     18.4116 | Minor Dam  |         2 |
| BERG RIVER      |   -33.9262 |     19.0618 | Major Dam  |         4 |
| DE VILLIERS     |   -33.9926 |     18.4112 | Minor Dam  |         2 |
| HELY-HUTCHINSON |   -33.9769 |     18.4096 | Minor Dam  |         2 |
| KLEINPLAATS     |   -34.1719 |     18.3868 | Minor Dam  |         2 |
| LEWIS GAY       |   -34.1674 |     18.3959 | Minor Dam  |         2 |
| STEENBRAS LOWER |   -34.1805 |     18.8667 | Major Dam  |         2 |
| STEENBRAS UPPER |   -34.1667 |     18.9098 | Major Dam  |         2 |
| THEEWATERSKLOOF |   -34.0759 |     19.2919 | Major Dam  |         5 |
| VICTORIA        |   -33.9856 |     18.4061 | Minor Dam  |         2 |


Table: merged
|   month | precipitation      | storage             |
|--------:|:-------------------|:--------------------|
|       1 |                    |                     |
|       2 | 25.229240282685502 | -5113.1855295242422 |
|       3 | 22.65133215547705  | -4572.3674658674645 |
|       4 | 31.671961130742027 | -3090.4065934065911 |
|       5 | 73.819399293286182 | -1050.4998227578872 |
|       6 | 128.6693109540636  | 5132.74011579818    |
|       7 | 176.53383392226146 | 7608.2772539288635  |
|       8 | 164.78734982332134 | 6767.6061680255225  |
|       9 | 142.72226148409877 | 3913.2634644924983  |
|      10 | 91.051805309734377 | 265.2342646815523   |


Table: Municipalities
|   muni_id | muni_name         |
|----------:|:------------------|
|         1 | Breede Valley     |
|         2 | City of Cape Town |
|         3 | Drakenstein       |
|         4 | Stellenbosch      |
|         5 | Theewaterskloof   |
|         6 | Witzenberg        |


Table: Perc_dam_capacity
| name            | date                    |   Percentage of Dam Capacity |
|:----------------|:------------------------|-----------------------------:|
| HELY-HUTCHINSON | 2012-07-14 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-16 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-17 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-18 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-19 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-21 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-23 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-24 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-25 00:00:00.000 |                          100 |
| HELY-HUTCHINSON | 2012-07-26 00:00:00.000 |                          100 |


Table: PopulationEstimate
|   population_id |   population1 |   population2 | date                    |
|----------------:|--------------:|--------------:|:------------------------|
|               1 |       1567152 |       1581853 | 1980-01-01 00:00:00.000 |
|               2 |       1620588 |       1640692 | 1981-01-01 00:00:00.000 |
|               3 |       1675355 |       1701610 | 1982-01-01 00:00:00.000 |
|               4 |       1731434 |       1764436 | 1983-01-01 00:00:00.000 |
|               5 |       1788802 |       1829002 | 1984-01-01 00:00:00.000 |
|               6 |       1847438 |       1895138 | 1985-01-01 00:00:00.000 |
|               7 |       1907323 |       1962674 | 1986-01-01 00:00:00.000 |
|               8 |       1968433 |       2031442 | 1987-01-01 00:00:00.000 |
|               9 |       2030749 |       2101271 | 1988-01-01 00:00:00.000 |
|              10 |       2094250 |       2171993 | 1989-01-01 00:00:00.000 |


Table: RainStations
|   rain_station_id |   muni_id | name            |   latitude |   longitude |
|------------------:|----------:|:----------------|-----------:|------------:|
|                 1 |         4 | ASSEGAAIBOS     |   -33.9417 |     19.0661 |
|                 2 |         1 | BERGDUMP        |   -33.4376 |     19.5702 |
|                 3 |         6 | CERES           |   -33.3626 |     19.2744 |
|                 4 |         1 | HAWEQWAS        |   -33.8347 |     19.2508 |
|                 5 |         2 | HIGGOVALE       |   -33.9376 |     18.4119 |
|                 6 |         4 | JONKERSHOEK     |   -33.9125 |     18.9439 |
|                 7 |         2 | KOGEL_BAAI      |   -34.1797 |     18.8514 |
|                 8 |         1 | KWAGGASKLOOF    |   -33.7609 |     19.4741 |
|                 9 |         2 | NEWLAND         |   -33.9667 |     18.4494 |
|                10 |         2 | STEENBRAS LOWER |   -34.1805 |     18.8667 |


Table: Rainstations_Muni
| name            | muni_name         |
|:----------------|:------------------|
| VOLELVLEI       | Drakenstein       |
| TAFELBERG       | City of Cape Town |
| JONKERSHOEK     | Stellenbosch      |
| THEEWATERSKLOOF | Theewaterskloof   |
| BERGDUMP        | Breede Valley     |
| CERES           | Witzenberg        |
| ASSEGAAIBOS     | Stellenbosch      |
| NEWLAND         | City of Cape Town |
| ZACHARIASHOEK   | Drakenstein       |
| STEENBRAS LOWER | City of Cape Town |


Table: RecordedRainfall
|   recorded_rainfall_id |   rain_station_id | date                    |   precipitation |   Month | Season   |   Year |   Year offset Dec |   Sort Season | Month abb   | Column   |
|-----------------------:|------------------:|:------------------------|----------------:|--------:|:---------|-------:|------------------:|--------------:|:------------|:---------|
|                   2138 |                 6 | 1978-11-01 00:00:00.000 |               0 |      11 | Spring   |   1978 |              1978 |             4 |             |          |
|                   2179 |                 6 | 1982-04-01 00:00:00.000 |               0 |       4 | Autumn   |   1982 |              1982 |             2 |             |          |
|                   2249 |                 6 | 1988-02-01 00:00:00.000 |               0 |       2 | Summer   |   1988 |              1988 |             1 |             |          |
|                   2286 |                 6 | 1991-03-01 00:00:00.000 |               0 |       3 | Autumn   |   1991 |              1991 |             2 |             |          |
|                   2303 |                 6 | 1992-08-01 00:00:00.000 |               0 |       8 | Winter   |   1992 |              1992 |             3 |             |          |
|                   2304 |                 6 | 1992-09-01 00:00:00.000 |               0 |       9 | Spring   |   1992 |              1992 |             4 |             |          |
|                   2342 |                 6 | 1995-11-01 00:00:00.000 |               0 |      11 | Spring   |   1995 |              1995 |             4 |             |          |
|                   2346 |                 6 | 1996-03-01 00:00:00.000 |               0 |       3 | Autumn   |   1996 |              1996 |             2 |             |          |
|                   2352 |                 6 | 1996-09-01 00:00:00.000 |               0 |       9 | Spring   |   1996 |              1996 |             4 |             |          |
|                   2353 |                 6 | 1996-10-01 00:00:00.000 |               0 |      10 | Spring   |   1996 |              1996 |             4 |             |          |


Table: SupplyDams
|   supply_dam_id |   muni_id | name            |   latitude |   longitude |   total_dam_capacity |   tot_s_area_m2 | categories   |   coct_tot_dam_cap |
|----------------:|----------:|:----------------|-----------:|------------:|---------------------:|----------------:|:-------------|-------------------:|
|               1 |         2 | ALEXANDRA       |   -33.988  |     18.4116 |                  134 |           22896 | Minor Dam    |                126 |
|               2 |         4 | BERG RIVER      |   -33.9262 |     19.0618 |               129966 |         5445912 | Major Dam    |             130010 |
|               4 |         2 | DE VILLIERS     |   -33.9926 |     18.4112 |                  243 |           31327 | Minor Dam    |                243 |
|               5 |         2 | HELY-HUTCHINSON |   -33.9769 |     18.4096 |                  924 |          165426 | Minor Dam    |                925 |
|               6 |         2 | KLEINPLAATS     |   -34.1719 |     18.3868 |                 1301 |          222551 | Minor Dam    |               1368 |
|               7 |         2 | LEWIS GAY       |   -34.1674 |     18.3959 |                  167 |           33772 | Minor Dam    |                182 |
|               8 |         2 | STEENBRAS LOWER |   -34.1805 |     18.8667 |                33497 |         3560794 | Major Dam    |              33517 |
|               9 |         2 | STEENBRAS UPPER |   -34.1667 |     18.9098 |                31781 |         2654965 | Major Dam    |              31767 |
|              10 |         5 | THEEWATERSKLOOF |   -34.0759 |     19.2919 |               480487 |        46632576 | Major Dam    |             480188 |
|              11 |         2 | VICTORIA        |   -33.9856 |     18.4061 |                  126 |           47142 | Minor Dam    |                128 |


Table: TotalConsumption
| date                    |   total_consumption |
|:------------------------|--------------------:|
| 2008-01-01 00:00:00.000 |                1987 |
| 2008-02-01 00:00:00.000 |                1997 |
| 2008-03-01 00:00:00.000 |                1805 |
| 2008-04-01 00:00:00.000 |                1417 |
| 2008-05-01 00:00:00.000 |                 921 |
| 2008-06-01 00:00:00.000 |                 782 |
| 2008-07-01 00:00:00.000 |                 806 |
| 2008-08-01 00:00:00.000 |                 815 |
| 2008-09-01 00:00:00.000 |                 807 |
| 2008-10-01 00:00:00.000 |                 983 |


Table: WaterRestrictions
|   Month |   Year |   Restriction Level |   Restriction Level Num | Person Daily usage   | City Daily usage   | Date                    |
|--------:|-------:|--------------------:|------------------------:|:---------------------|:-------------------|:------------------------|
|      11 |   2005 |                   1 |                       1 |                      |                    | 2005-11-01 00:00:00.000 |
|      12 |   2005 |                   1 |                       1 |                      |                    | 2005-12-01 00:00:00.000 |
|       1 |   2006 |                   1 |                       1 |                      |                    | 2006-01-01 00:00:00.000 |
|       2 |   2006 |                   1 |                       1 |                      |                    | 2006-02-01 00:00:00.000 |
|       3 |   2006 |                   1 |                       1 |                      |                    | 2006-03-01 00:00:00.000 |
|       4 |   2006 |                   1 |                       1 |                      |                    | 2006-04-01 00:00:00.000 |
|       5 |   2006 |                   1 |                       1 |                      |                    | 2006-05-01 00:00:00.000 |
|       6 |   2006 |                   1 |                       1 |                      |                    | 2006-06-01 00:00:00.000 |
|       7 |   2006 |                   1 |                       1 |                      |                    | 2006-07-01 00:00:00.000 |
|       8 |   2006 |                   1 |                       1 |                      |                    | 2006-08-01 00:00:00.000 |

 


tables: name: Dams_Muni
data: Dams_Muni.csv
name: Dam_levels
data: Dam_levels.csv
name: Dam_Storage_Diff_between_dates
data: Dam_Storage_Diff_between_dates.csv
name: DeltaStorage
data: DeltaStorage.csv
name: DemandConsumption
data: DemandConsumption.csv
name: df_locations
data: df_locations.csv
name: merged
data: merged.csv
name: Municipalities
data: Municipalities.csv
name: Perc_dam_capacity
data: Perc_dam_capacity.csv
name: PopulationEstimate
data: PopulationEstimate.csv
name: RainStations
data: RainStations.csv
name: Rainstations_Muni
data: Rainstations_Muni.csv
name: RecordedRainfall
data: RecordedRainfall.csv
name: SupplyDams
data: SupplyDams.csv
name: TotalConsumption
data: TotalConsumption.csv
name: WaterRestrictions
data: WaterRestrictions.csv
label: RainStations
muni_id
Municipalities
muni_id
SupplyDams
muni_id
Municipalities
muni_id
RecordedRainfall
rain_station_id
RainStations
rain_station_id
Dams_Muni
muni_name
Municipalities
muni_name
Rainstations_Muni
muni_name
Municipalities
muni_name
Dam_Storage_Diff_between_dates
name
SupplyDams
name
df_locations
name
SupplyDams
name
DeltaStorage
DamName
SupplyDams
name
Dam_levels
Dam
SupplyDams
name
WaterRestrictions
Month
merged
month
output: {
    "joins": [
        {
            "from_table": "RainStations",
            "from_column": "muni_id",
            "to_table": "Municipalities",
            "to_column": "muni_id"
        },
        {
            "from_table": "SupplyDams",
            "from_column": "muni_id",
            "to_table": "Municipalities",
            "to_column": "muni_id"
        },
        {
            "from_table": "RecordedRainfall",
            "from_column": "rain_station_id",
            "to_table": "RainStations",
            "to_column": "rain_station_id"
        },
        {
            "from_table": "Dams_Muni",
            "from_column": "muni_name",
            "to_table": "Municipalities",
            "to_column": "muni_name"
        },
        {
            "from_table": "Rainstations_Muni",
            "from_column": "muni_name",
            "to_table": "Municipalities",
            "to_column": "muni_name"
        },
        {
            "from_table": "Dam_Storage_Diff_between_dates",
            "from_column": "name",
            "to_table": "SupplyDams",
            "to_column": "name"
        },
        {
            "from_table": "df_locations",
            "from_column": "name",
            "to_table": "SupplyDams",
            "to_column": "name"
        },
        {
            "from_table": "DeltaStorage",
            "from_column": "DamName",
            "to_table": "SupplyDams",
            "to_column": "name"
        },
        {
            "from_table": "Dam_levels",
            "from_column": "Dam",
            "to_table": "SupplyDams",
            "to_column": "name"
        },
        {
            "from_table": "WaterRestrictions",
            "from_column": "Month",
            "to_table": "merged",
            "to_column": "month"
        }
    ]
}