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: Customer
|   Customer ID | Customer Name                      | Credit Limit   | Address Line 1   | Address Line 2             |   Postal Code | Customer Category   | Buying Group   |
|--------------:|:-----------------------------------|:---------------|:-----------------|:---------------------------|--------------:|:--------------------|:---------------|
|             1 | Tailspin Toys (Head Office)        |                | Shop 38          | 1877 Mittal Road           |         90410 | Novelty Shop        | Tailspin Toys  |
|             2 | Tailspin Toys (Sylvanite, MT)      |                | Shop 245         | 705 Dita Lane              |         90216 | Novelty Shop        | Tailspin Toys  |
|             3 | Tailspin Toys (Peeples Valley, AZ) |                | Unit 217         | 1970 Khandke Road          |         90205 | Novelty Shop        | Tailspin Toys  |
|             4 | Tailspin Toys (Medicine Lodge, KS) |                | Suite 164        | 967 Riutta Boulevard       |         90152 | Novelty Shop        | Tailspin Toys  |
|             5 | Tailspin Toys (Gasport, NY)        |                | Unit 176         | 1674 Skujins Boulevard     |         90261 | Novelty Shop        | Tailspin Toys  |
|             6 | Tailspin Toys (Jessie, ND)         |                | Shop 196         | 483 Raut Lane              |         90298 | Novelty Shop        | Tailspin Toys  |
|             7 | Tailspin Toys (Frankewing, TN)     |                | Shop 27          | 904 Kellnerova Street      |         90761 | Novelty Shop        | Tailspin Toys  |
|             8 | Tailspin Toys (Bow Mar, CO)        |                | Shop 282         | 752 Shaker Doust Boulevard |         90484 | Novelty Shop        | Tailspin Toys  |
|             9 | Tailspin Toys (Netcong, NJ)        |                | Shop 33          | 25 Kasesalu Street         |         90129 | Novelty Shop        | Tailspin Toys  |
|            10 | Tailspin Toys (Wimbledon, ND)      |                | Unit 67          | 372 Joo Lane               |         90061 | Novelty Shop        | Tailspin Toys  |


Table: Database Name
| Database Name      |
|:-------------------|
| WideWorldImporters |


Table: Date
| Date                    |   Year |   Quarter of Year |   Month of Year |   Day of Month |   Date Key | Month Name   | Month    | Quarter   |   Day of Week | Day of Week Name   | Week Ending             |   Relative Date Offset |   Relative Week Offset |   Relative Month Offset |   Relative Year Offset |   Month Key |   Quarter Key |   CrossJoin ID | Relative Date   | Relative Week   | Relative Month   | Relative Year   |
|:------------------------|-------:|------------------:|----------------:|---------------:|-----------:|:-------------|:---------|:----------|--------------:|:-------------------|:------------------------|-----------------------:|-----------------------:|------------------------:|-----------------------:|------------:|--------------:|---------------:|:----------------|:----------------|:-----------------|:----------------|
| 2013-07-01 00:00:00.000 |   2013 |                 3 |               7 |              1 |   20130701 | July         | Jul 2013 | Q3 2013   |             2 | Monday             | 2013-07-05 00:00:00.000 |                  -2109 |                   -301 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2109    | This Week - 301 | This Month - 69  | This Year - 6   |
| 2013-07-02 00:00:00.000 |   2013 |                 3 |               7 |              2 |   20130702 | July         | Jul 2013 | Q3 2013   |             3 | Tuesday            | 2013-07-05 00:00:00.000 |                  -2108 |                   -301 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2108    | This Week - 301 | This Month - 69  | This Year - 6   |
| 2013-07-03 00:00:00.000 |   2013 |                 3 |               7 |              3 |   20130703 | July         | Jul 2013 | Q3 2013   |             4 | Wednesday          | 2013-07-05 00:00:00.000 |                  -2107 |                   -301 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2107    | This Week - 301 | This Month - 69  | This Year - 6   |
| 2013-07-04 00:00:00.000 |   2013 |                 3 |               7 |              4 |   20130704 | July         | Jul 2013 | Q3 2013   |             5 | Thursday           | 2013-07-05 00:00:00.000 |                  -2106 |                   -301 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2106    | This Week - 301 | This Month - 69  | This Year - 6   |
| 2013-07-05 00:00:00.000 |   2013 |                 3 |               7 |              5 |   20130705 | July         | Jul 2013 | Q3 2013   |             6 | Friday             | 2013-07-05 00:00:00.000 |                  -2105 |                   -301 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2105    | This Week - 301 | This Month - 69  | This Year - 6   |
| 2013-07-06 00:00:00.000 |   2013 |                 3 |               7 |              6 |   20130706 | July         | Jul 2013 | Q3 2013   |             7 | Saturday           | 2013-07-12 00:00:00.000 |                  -2104 |                   -300 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2104    | This Week - 300 | This Month - 69  | This Year - 6   |
| 2013-07-07 00:00:00.000 |   2013 |                 3 |               7 |              7 |   20130707 | July         | Jul 2013 | Q3 2013   |             1 | Sunday             | 2013-07-12 00:00:00.000 |                  -2103 |                   -300 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2103    | This Week - 300 | This Month - 69  | This Year - 6   |
| 2013-07-08 00:00:00.000 |   2013 |                 3 |               7 |              8 |   20130708 | July         | Jul 2013 | Q3 2013   |             2 | Monday             | 2013-07-12 00:00:00.000 |                  -2102 |                   -300 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2102    | This Week - 300 | This Month - 69  | This Year - 6   |
| 2013-07-09 00:00:00.000 |   2013 |                 3 |               7 |              9 |   20130709 | July         | Jul 2013 | Q3 2013   |             3 | Tuesday            | 2013-07-12 00:00:00.000 |                  -2101 |                   -300 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2101    | This Week - 300 | This Month - 69  | This Year - 6   |
| 2013-07-10 00:00:00.000 |   2013 |                 3 |               7 |             10 |   20130710 | July         | Jul 2013 | Q3 2013   |             4 | Wednesday          | 2013-07-12 00:00:00.000 |                  -2100 |                   -300 |                     -69 |                     -6 |      201307 |         20133 |              1 | Today - 2100    | This Week - 300 | This Month - 69  | This Year - 6   |


Table: Metadata
| Last Refresh Date Label                            |
|:---------------------------------------------------|
| Last Refresh Date: 4/10/2019 2:50:26 PM (UTC-7:00) |


Table: Sales Invoice Line
|   Invoice Line ID |   Invoice ID |   Stock Item ID | Description                                                              |   Quantity |   Unit Price |   Tax Rate |   Tax Amount |   Profit Amount |   Ext Price |
|------------------:|-------------:|----------------:|:-------------------------------------------------------------------------|-----------:|-------------:|-----------:|-------------:|----------------:|------------:|
|              1227 |          456 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|              3880 |         1245 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|              4042 |         1294 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|              6602 |         2036 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|              8228 |         2534 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|              8652 |         2670 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|              9553 |         2938 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|             10206 |         3136 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|             10796 |         3319 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |
|             11991 |         3678 |              39 | Developer joke mug - inheritance is the OO way to become wealthy (Black) |          7 |           13 |         15 |        13.65 |            59.5 |      104.65 |


Table: Sales Invoice
|   Invoice ID |   Customer ID |   Order ID | Invoice Date            |   Customer PO # | Credit Note   | Credit Reason   | Comments   |   # Dry Items |   # Chiller Items | Delivery Time           | Received By         |
|-------------:|--------------:|-----------:|:------------------------|----------------:|:--------------|:----------------|:-----------|--------------:|------------------:|:------------------------|:--------------------|
|            4 |            57 |          4 | 2013-01-01 00:00:00.000 |           17129 | False         |                 |            |             3 |                 0 | 2013-01-02 07:20:00.000 | Aile Mae            |
|            5 |           905 |          5 | 2013-01-01 00:00:00.000 |           10369 | False         |                 |            |             3 |                 0 | 2013-01-02 07:25:00.000 | Sara Huiting        |
|            6 |           976 |          6 | 2013-01-01 00:00:00.000 |           13383 | False         |                 |            |             3 |                 0 | 2013-01-02 07:30:00.000 | Alinne Matos        |
|            8 |           964 |          8 | 2013-01-01 00:00:00.000 |           14518 | False         |                 |            |             3 |                 0 | 2013-01-02 07:40:00.000 | Ingrida Zeltina     |
|           14 |           870 |         14 | 2013-01-01 00:00:00.000 |           17521 | False         |                 |            |             3 |                 0 | 2013-01-02 08:10:00.000 | In-Su Bae           |
|           19 |           973 |         20 | 2013-01-01 00:00:00.000 |           12227 | False         |                 |            |             3 |                 0 | 2013-01-02 08:35:00.000 | Kumar Kamei         |
|           21 |           173 |         23 | 2013-01-01 00:00:00.000 |           12467 | False         |                 |            |             3 |                 0 | 2013-01-02 08:45:00.000 | Raju Atluri         |
|           23 |           189 |         25 | 2013-01-01 00:00:00.000 |           11503 | False         |                 |            |             3 |                 0 | 2013-01-02 08:55:00.000 | Sara Charlton       |
|           28 |           148 |         30 | 2013-01-01 00:00:00.000 |           15084 | False         |                 |            |             3 |                 0 | 2013-01-02 09:20:00.000 | Marcella Napolitani |
|           31 |            92 |         34 | 2013-01-01 00:00:00.000 |           19457 | False         |                 |            |             3 |                 0 | 2013-01-02 09:35:00.000 | Coralie Emond       |


Table: Server Name
| Server Name   |
|:--------------|
| Stewie        |


Table: Source Query - Customer
| Source Query - Customer                                                                                                 |
|:------------------------------------------------------------------------------------------------------------------------|
| select  cus.[CustomerID]                                                                                                |
|     ,   cus.[CustomerName]                                                                                              |
|     ,   cat.[CustomerCategoryName]                                                                                      |
|     ,   grp.[BuyingGroupName]                                                                                           |
|     ,   cus.[CreditLimit]                                                                                               |
|     ,   cus.[DeliveryAddressLine1]                                                                                      |
|     ,   cus.[DeliveryAddressLine2]                                                                                      |
|     ,   cus.[DeliveryPostalCode]                                                                                        |
|                                                                                                                         |
| from    [WideWorldImporters].[Sales].[Customers] cus                                                                    |
| inner join [WideWorldImporters].[Sales].[CustomerCategories] cat on cat.[CustomerCategoryID] = cus.[CustomerCategoryID] |
| inner join [WideWorldImporters].[Sales].[BuyingGroups] grp on grp.[BuyingGroupID] = cus.[BuyingGroupID]                 |
| ;                                                                                                                       |


Table: Source Query - Invoice Line
| Source Query - Invoice Line                         |
|:----------------------------------------------------|
| select  [InvoiceLineID]                             |
|     ,   [InvoiceID]                                 |
|     ,   [StockItemID]                               |
|     ,   [Description]                               |
|     ,   [Quantity]                                  |
|     ,   [UnitPrice]                                 |
|     ,   [TaxRate]                                   |
|     ,   [TaxAmount]                                 |
|     ,   [LineProfit]                                |
|     ,   [ExtendedPrice]                             |
|                                                     |
| from    [WideWorldImporters].[Sales].[InvoiceLines] |
| ;                                                   |


Table: Source Query - Invoice
| Source Query - Invoice                          |
|:------------------------------------------------|
| select  [InvoiceID]                             |
|     ,   [CustomerID]                            |
|     ,   [OrderID]                               |
|     ,   [InvoiceDate]                           |
|     ,   [CustomerPurchaseOrderNumber]           |
|     ,   [IsCreditNote]                          |
|     ,   [CreditNoteReason]                      |
|     ,   [Comments]                              |
|     ,   [TotalDryItems]                         |
|     ,   [TotalChillerItems]                     |
|     ,   [ConfirmedDeliveryTime]                 |
|     ,   [ConfirmedReceivedBy]                   |
|                                                 |
| from    [WideWorldImporters].[Sales].[Invoices] |
| ;                                               |

 


tables: name: Customer
data: Customer.csv
name: Database Name
data: Database Name.csv
name: Date
data: Date.csv
name: Metadata
data: Metadata.csv
name: Sales Invoice Line
data: Sales Invoice Line.csv
name: Sales Invoice
data: Sales Invoice.csv
name: Server Name
data: Server Name.csv
name: Source Query - Customer
data: Source Query - Customer.csv
name: Source Query - Invoice Line
data: Source Query - Invoice Line.csv
name: Source Query - Invoice
data: Source Query - Invoice.csv
label: Sales Invoice
Customer ID
Customer
Customer ID
Sales Invoice Line
Invoice ID
Sales Invoice
Invoice ID
Sales Invoice
Invoice Date
Date
Date
output: {
    "joins": [
        {
            "from_table": "Sales Invoice",
            "from_column": "Customer ID",
            "to_table": "Customer",
            "to_column": "Customer ID"
        },
        {
            "from_table": "Sales Invoice Line",
            "from_column": "Invoice ID",
            "to_table": "Sales Invoice",
            "to_column": "Invoice ID"
        },
        {
            "from_table": "Sales Invoice",
            "from_column": "Invoice Date",
            "to_table": "Date",
            "to_column": "Date"
        }
    ]
}