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                    |
|:------------------------|
| 2015-12-17 00:00:00.000 |
| 2015-12-21 00:00:00.000 |
| 2015-12-22 00:00:00.000 |
| 2015-12-23 00:00:00.000 |
| 2015-12-27 00:00:00.000 |
| 2015-12-29 00:00:00.000 |
| 2016-01-04 00:00:00.000 |
| 2016-01-05 00:00:00.000 |
| 2016-01-06 00:00:00.000 |
| 2016-01-07 00:00:00.000 |


Table: Habitat
|   HabitatId | HabitatName   |   EnvironmentId | BackColour   | ForeColour   |
|------------:|:--------------|----------------:|:-------------|:-------------|
|           1 | Grasslands    |               1 | Light green  | Black        |
|           2 | Forest        |               1 | Dark green   | White        |
|           3 | Fresh water   |               3 | LightBlue    | Dark blue    |
|           4 | Salt water    |               3 | #78aaf5      | White        |
|           5 | Desert        |               1 | #d6a740      | Black        |
|           6 | Urban         |               1 | #222         | White        |
|           7 | Sky           |               2 | #0a66f0      | White        |


Table: Mode
|   EnvironmentId | EnvironmentName   |
|----------------:|:------------------|
|               1 | Land              |
|               2 | Air               |
|               3 | Water             |


Table: POS Type
|   CentreTypeId | CentreTypeName   |
|---------------:|:-----------------|
|              1 | Factory Outlet   |
|              2 | Retail Park      |
|              3 | Shopping Centre  |
|              4 | Shopping Park    |


Table: POS
|   CentreId | CentreName                   |   TownId |   CentreTypeId | PostCode   |   SquareMetres |   NumberUnits |
|-----------:|:-----------------------------|---------:|---------------:|:-----------|---------------:|--------------:|
|          1 | Pavilion Shopping Centre     |      180 |              3 | EN8 7BZ    |          15143 |            62 |
|          2 | Times Square Shopping Centre |      170 |              3 | SM1 1LF    |          15143 |            71 |
|          4 | Norman Park                  |        9 |              3 | CB3 8EL    |          15228 |            11 |
|          7 | Cannon Park Shopping Centre  |       48 |              3 | CV4 7EH    |          15329 |            36 |
|         12 | Kingsmead Shopping Centre    |       69 |              3 | GU14 7SJ   |          15515 |            69 |
|         13 | Market Quay                  |       68 |              3 | PO16       |          15515 |             0 |
|         19 | Old George Mall              |      148 |              3 | SP1 2NH    |          15794 |            37 |
|         20 | The Nicholson's Centre       |      113 |              3 | SL6 1LB    |          15794 |            64 |
|         25 | The Longford Shopping Centre |       70 |              3 | TW13 4BH   |          15979 |            85 |
|         26 | Southgate Shopping Centre    |       15 |              3 | BA1 1TQ    |          16072 |            34 |


Table: Product
|   ProductId | ProductName   | Animal    |   HabitatId |   Legs |   FamilyId |   WeightGrams |   ProductionCost |
|------------:|:--------------|:----------|------------:|-------:|-----------:|--------------:|-----------------:|
|           1 | Sammy         | Snake     |           1 |      0 |          1 |           950 |             7.19 |
|           2 | Pokyo         | Penguin   |           4 |      2 |          3 |           850 |             4.5  |
|           3 | Fenella       | Frog      |           3 |      4 |          4 |           400 |            10.79 |
|           4 | Layla         | Lemur     |           2 |      2 |          5 |           550 |             4.28 |
|           5 | Dave          | Dachsund  |           1 |      4 |          5 |           775 |             5.85 |
|           6 | Kylie         | Camel     |           5 |      4 |          5 |          1200 |             3.15 |
|           7 | Jeremy        | Jackdaw   |           7 |      2 |          3 |           295 |             7.65 |
|           8 | Faye          | Fox       |           6 |      4 |          5 |           420 |             4.95 |
|           9 | Oliver        | Owl       |           7 |      2 |          3 |           380 |             6.75 |
|          10 | Cleopatra     | Clownfish |           4 |      0 |          2 |           290 |             2.69 |


Table: Purchase
|   PurchaseId | PurchaseDate            |   ProductId |   CentreId |   Quantity |   Price | PaymentDate   |   StaffId |   Revenue |
|-------------:|:------------------------|------------:|-----------:|-----------:|--------:|:--------------|----------:|----------:|
|        15470 | 2017-01-01 00:00:00.000 |           1 |        258 |          1 |     8.5 | 01-01-2017    |      4671 |       8.5 |
|        15486 | 2017-01-02 00:00:00.000 |           1 |        352 |          1 |     8.5 | 02-01-2017    |      5511 |       8.5 |
|        15492 | 2017-01-02 00:00:00.000 |           1 |        319 |          1 |     8.5 | 02-01-2017    |      4955 |       8.5 |
|        15505 | 2017-01-02 00:00:00.000 |           1 |        332 |          1 |     8.5 | 02-01-2017    |      5031 |       8.5 |
|        15737 | 2017-01-04 00:00:00.000 |           1 |        338 |          1 |     8.5 | 04-01-2017    |      5074 |       8.5 |
|        15739 | 2017-01-04 00:00:00.000 |           1 |        348 |          1 |     8.5 | 04-01-2017    |      5129 |       8.5 |
|        15823 | 2017-01-04 00:00:00.000 |           1 |        121 |          1 |     8.5 | 04-01-2017    |      3947 |       8.5 |
|        15830 | 2017-01-04 00:00:00.000 |           1 |        332 |          1 |     8.5 | 04-01-2017    |      5031 |       8.5 |
|        15843 | 2017-01-05 00:00:00.000 |           1 |        376 |          1 |     8.5 | 05-01-2017    |      5377 |       8.5 |
|        15923 | 2017-01-05 00:00:00.000 |           1 |        292 |          1 |     8.5 | 05-01-2017    |      4835 |       8.5 |


Table: Region
|   RegionId | RegionName             |
|-----------:|:-----------------------|
|          1 | East Anglia            |
|          2 | East Midlands          |
|          3 | London                 |
|          4 | North                  |
|          5 | North West             |
|          6 | South East             |
|          7 | South West             |
|          8 | West Midlands          |
|          9 | Yorkshire & Humberside |


Table: Species
|   FamilyId | FamilyName   |
|-----------:|:-------------|
|          1 | Reptile      |
|          2 | Fish         |
|          3 | Bird         |
|          4 | Amphibian    |
|          5 | Mammal       |
|          6 | Insect       |


Table: Town
|   TownId | TownName          |   RegionId |
|---------:|:------------------|-----------:|
|        1 | Aintree           |          5 |
|        2 | Aldershot         |          6 |
|        3 | Altrincham        |          5 |
|        4 | Andover           |          6 |
|        5 | Ashford           |          6 |
|        6 | Ashton Under Lyne |          5 |
|        7 | Aylesbury         |          6 |
|        8 | Banbury           |          6 |
|        9 | Barhill           |          1 |
|       10 | Barking           |          3 |

 


tables: name: Calendar
data: Calendar.csv
name: Habitat
data: Habitat.csv
name: Mode
data: Mode.csv
name: POS Type
data: POS Type.csv
name: POS
data: POS.csv
name: Product
data: Product.csv
name: Purchase
data: Purchase.csv
name: Region
data: Region.csv
name: Species
data: Species.csv
name: Town
data: Town.csv
label: Product
HabitatId
Habitat
HabitatId
Habitat
EnvironmentId
Mode
EnvironmentId
Purchase
CentreId
POS
CentreId
POS
TownId
Town
TownId
POS
CentreTypeId
POS Type
CentreTypeId
Purchase
ProductId
Product
ProductId
Product
FamilyId
Species
FamilyId
Town
RegionId
Region
RegionId
Purchase
PurchaseDate
Calendar
Date
output: {
    "joins": [
        {
            "from_table": "Product",
            "from_column": "HabitatId",
            "to_table": "Habitat",
            "to_column": "HabitatId"
        },
        {
            "from_table": "Habitat",
            "from_column": "EnvironmentId",
            "to_table": "Mode",
            "to_column": "EnvironmentId"
        },
        {
            "from_table": "Purchase",
            "from_column": "CentreId",
            "to_table": "POS",
            "to_column": "CentreId"
        },
        {
            "from_table": "POS",
            "from_column": "TownId",
            "to_table": "Town",
            "to_column": "TownId"
        },
        {
            "from_table": "POS",
            "from_column": "CentreTypeId",
            "to_table": "POS Type",
            "to_column": "CentreTypeId"
        },
        {
            "from_table": "Purchase",
            "from_column": "ProductId",
            "to_table": "Product",
            "to_column": "ProductId"
        },
        {
            "from_table": "Product",
            "from_column": "FamilyId",
            "to_table": "Species",
            "to_column": "FamilyId"
        },
        {
            "from_table": "Town",
            "from_column": "RegionId",
            "to_table": "Region",
            "to_column": "RegionId"
        },
        {
            "from_table": "Purchase",
            "from_column": "PurchaseDate",
            "to_table": "Calendar",
            "to_column": "Date"
        }
    ]
}