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: Billing
| ID1      |   Qty_Shipped | Ship_Date               |   Ship_Dollars |   So_Nbr | Item Nbr   | Requested Ship Date     | RevenueBucket   |   Cust_Nbr |   Ship_Cust_Nbr |   Ship_Cost |
|:---------|--------------:|:------------------------|---------------:|---------:|:-----------|:------------------------|:----------------|-----------:|----------------:|------------:|
| 766100*2 |             1 | 2020-04-24 00:00:00.000 |              2 |   766100 | 46216|01   | 2020-04-22 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 766104*1 |             1 | 2020-04-24 00:00:00.000 |              2 |   766104 | 46216|01   | 2020-04-22 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 770593*1 |             1 | 2020-07-10 00:00:00.000 |              2 |   770593 | 46216|01   | 2020-07-10 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 770594*1 |             1 | 2020-07-10 00:00:00.000 |              2 |   770594 | 46216|01   | 2020-07-10 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 770598*1 |             1 | 2020-07-10 00:00:00.000 |              2 |   770598 | 46216|01   | 2020-07-10 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 770600*1 |             1 | 2020-07-10 00:00:00.000 |              2 |   770600 | 46216|01   | 2020-07-10 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 771046*1 |             1 | 2020-07-17 00:00:00.000 |              2 |   771046 | 46216|01   | 2020-07-16 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 771107*1 |             1 | 2020-07-17 00:00:00.000 |              2 |   771107 | 46216|01   | 2020-07-17 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 769426*1 |             1 | 2020-06-26 00:00:00.000 |              2 |   769426 | 46216|01   | 2020-06-26 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |
| 768142*1 |             1 | 2020-06-05 00:00:00.000 |              2 |   768142 | 46216|01   | 2020-06-05 00:00:00.000 | PIT-1           |     226592 |          226592 |           1 |


Table: Customers
|   Cust_Nbr | Name           | City   | State   | Zip   | Phone   | Last_Order_Date   | Last_Sales_Order   | Active_Flag   | Date_Added   | Country_Code   |   Bill_To_Cust_Nbr | So_Bal   | Oldest_Inv_Date   | Tot_Payments   | Tot_Pay_Amt   | Customer_Since_Date   | Addr   | Addr2   | Mch_Pin   |   PBI Sales |
|-----------:|:---------------|:-------|:--------|:------|:--------|:------------------|:-------------------|:--------------|:-------------|:---------------|-------------------:|:---------|:------------------|:---------------|:--------------|:----------------------|:-------|:--------|:----------|------------:|
|     100107 | Customer 10828 |        | TX      |       |         |                   |                    |               |              | US             |             100107 |          |                   |                |               |                       |        |         |           |           2 |
|     100140 | Customer 15993 |        | TX      |       |         |                   |                    |               |              | US             |             100140 |          |                   |                |               |                       |        |         |           |           8 |
|     100174 | Customer 33240 |        | TX      |       |         |                   |                    |               |              | US             |             100174 |          |                   |                |               |                       |        |         |           |          10 |
|     100178 | Customer 11620 |        | TX      |       |         |                   |                    |               |              | US             |             100178 |          |                   |                |               |                       |        |         |           |          32 |
|     100186 | Customer 10895 |        | TX      |       |         |                   |                    |               |              | US             |             100186 |          |                   |                |               |                       |        |         |           |          14 |
|     100204 | Customer 13233 |        | TX      |       |         |                   |                    |               |              | US             |             100204 |          |                   |                |               |                       |        |         |           |          16 |
|     100233 | Customer 15877 |        | TX      |       |         |                   |                    |               |              | US             |             100233 |          |                   |                |               |                       |        |         |           |          22 |
|     100369 | Customer 27685 |        | TX      |       |         |                   |                    |               |              | US             |             100369 |          |                   |                |               |                       |        |         |           |           6 |
|     100480 | Customer 21077 |        | TX      |       |         |                   |                    |               |              | US             |             100480 |          |                   |                |               |                       |        |         |           |           4 |
|     100499 | Customer 19041 |        | TX      |       |         |                   |                    |               |              | US             |             100499 |          |                   |                |               |                       |        |         |           |          10 |


Table: Dates
| Date                    |   Year |   QuarterOfYear |   MonthOfYear |   DayOfMonth |   DateInt | Month Name   | Month & Year   | Quarter & Year   |   DayOfWeek | DayOfWeekName   | WeekEnding              | MonthEnding             |   ISO Weeknumber |   ISO Year |   ISO Day of Year | Week & Year   |   WeeknYear |   MonthnYear |   QuarternYear | Fiscal Year   | Fiscal Quarter   |   Fiscal Period | IsAfterToday   | IsWorkingDay   | IsHoliday   | IsBusinessDay   | Day Type   |   WeekOffset |   MonthOffset |   QuarterOffset |   YearOffset |   FiscalYearOffset | WeekCompleted   | MonthCompleted   | QuarterCompleted   |
|:------------------------|-------:|----------------:|--------------:|-------------:|----------:|:-------------|:---------------|:-----------------|------------:|:----------------|:------------------------|:------------------------|-----------------:|-----------:|------------------:|:--------------|------------:|-------------:|---------------:|:--------------|:-----------------|----------------:|:---------------|:---------------|:------------|:----------------|:-----------|-------------:|--------------:|----------------:|-------------:|-------------------:|:----------------|:-----------------|:-------------------|
| 2014-01-01 00:00:00.000 |   2014 |               1 |             1 |            1 |  20140101 | January      | Jan 2014       | Q1 2014          |           4 | Wednesday       | 2014-01-05 00:00:00.000 | 2014-01-31 00:00:00.000 |                1 |       2014 |                 1 | 2014-01       |    20140100 |     20140100 |       20140100 | FY15          | FQ1              |               1 | False          | True           | Unknown     | True            | Weekday    |         -351 |           -80 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-01-08 00:00:00.000 |   2014 |               1 |             1 |            8 |  20140108 | January      | Jan 2014       | Q1 2014          |           4 | Wednesday       | 2014-01-12 00:00:00.000 | 2014-01-31 00:00:00.000 |                2 |       2014 |                 8 | 2014-02       |    20140200 |     20140100 |       20140100 | FY15          | FQ1              |               1 | False          | True           | Unknown     | True            | Weekday    |         -350 |           -80 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-01-15 00:00:00.000 |   2014 |               1 |             1 |           15 |  20140115 | January      | Jan 2014       | Q1 2014          |           4 | Wednesday       | 2014-01-19 00:00:00.000 | 2014-01-31 00:00:00.000 |                3 |       2014 |                15 | 2014-03       |    20140300 |     20140100 |       20140100 | FY15          | FQ1              |               1 | False          | True           | Unknown     | True            | Weekday    |         -349 |           -80 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-01-22 00:00:00.000 |   2014 |               1 |             1 |           22 |  20140122 | January      | Jan 2014       | Q1 2014          |           4 | Wednesday       | 2014-01-26 00:00:00.000 | 2014-01-31 00:00:00.000 |                4 |       2014 |                22 | 2014-04       |    20140400 |     20140100 |       20140100 | FY15          | FQ1              |               1 | False          | True           | Unknown     | True            | Weekday    |         -348 |           -80 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-01-29 00:00:00.000 |   2014 |               1 |             1 |           29 |  20140129 | January      | Jan 2014       | Q1 2014          |           4 | Wednesday       | 2014-02-02 00:00:00.000 | 2014-01-31 00:00:00.000 |                5 |       2014 |                29 | 2014-05       |    20140500 |     20140100 |       20140100 | FY15          | FQ1              |               1 | False          | True           | Unknown     | True            | Weekday    |         -347 |           -80 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-02-05 00:00:00.000 |   2014 |               1 |             2 |            5 |  20140205 | February     | Feb 2014       | Q1 2014          |           4 | Wednesday       | 2014-02-09 00:00:00.000 | 2014-02-28 00:00:00.000 |                6 |       2014 |                36 | 2014-06       |    20140600 |     20140200 |       20140100 | FY15          | FQ1              |               2 | False          | True           | Unknown     | True            | Weekday    |         -346 |           -79 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-02-12 00:00:00.000 |   2014 |               1 |             2 |           12 |  20140212 | February     | Feb 2014       | Q1 2014          |           4 | Wednesday       | 2014-02-16 00:00:00.000 | 2014-02-28 00:00:00.000 |                7 |       2014 |                43 | 2014-07       |    20140700 |     20140200 |       20140100 | FY15          | FQ1              |               2 | False          | True           | Unknown     | True            | Weekday    |         -345 |           -79 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-02-19 00:00:00.000 |   2014 |               1 |             2 |           19 |  20140219 | February     | Feb 2014       | Q1 2014          |           4 | Wednesday       | 2014-02-23 00:00:00.000 | 2014-02-28 00:00:00.000 |                8 |       2014 |                50 | 2014-08       |    20140800 |     20140200 |       20140100 | FY15          | FQ1              |               2 | False          | True           | Unknown     | True            | Weekday    |         -344 |           -79 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-02-26 00:00:00.000 |   2014 |               1 |             2 |           26 |  20140226 | February     | Feb 2014       | Q1 2014          |           4 | Wednesday       | 2014-03-02 00:00:00.000 | 2014-02-28 00:00:00.000 |                9 |       2014 |                57 | 2014-09       |    20140900 |     20140200 |       20140100 | FY15          | FQ1              |               2 | False          | True           | Unknown     | True            | Weekday    |         -343 |           -79 |             -26 |           -6 |                 -6 | True            | True             | True               |
| 2014-03-05 00:00:00.000 |   2014 |               1 |             3 |            5 |  20140305 | March        | Mar 2014       | Q1 2014          |           4 | Wednesday       | 2014-03-09 00:00:00.000 | 2014-03-31 00:00:00.000 |               10 |       2014 |                64 | 2014-10       |    20141000 |     20140300 |       20140100 | FY15          | FQ1              |               3 | False          | True           | Unknown     | True            | Weekday    |         -342 |           -78 |             -26 |           -6 |                 -6 | True            | True             | True               |


Table: Goals
| Portfolio   | Salesperson   |   Target | MonthYear               |
|:------------|:--------------|---------:|:------------------------|
| Portfolio 7 | PF            |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | SG            |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | AK            |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | TA            |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | MM            |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | CEM           |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | EC            |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | MA            |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | MOS           |        1 | 2020-01-01 00:00:00.000 |
| Portfolio 7 | HOY           |        1 | 2020-01-01 00:00:00.000 |


Table: Items
| Description   | Portfolio   | Family   | Section   | Category   | Item Nbr   | Engineering Status   | Product Nbr Description   |
|:--------------|:------------|:---------|:----------|:-----------|:-----------|:---------------------|:--------------------------|
| Product 1     | Portfolio 1 |          |           |            | 10001|01   | A                    | 10001|01 Product 1        |
| Product 2     | Portfolio 1 |          |           |            | 10003|01   | A                    | 10003|01 Product 2        |
| Product 3     | Portfolio 1 |          |           |            | 10007|01   | A                    | 10007|01 Product 3        |
| Product 5     | Portfolio 1 |          |           |            | 10011|01   | A                    | 10011|01 Product 5        |
| Product 7     | Portfolio 1 |          |           |            | 10099|01   | A                    | 10099|01 Product 7        |
| Product 12    | Portfolio 1 |          |           |            | 10197|01   | A                    | 10197|01 Product 12       |
| Product 15    | Portfolio 1 |          |           |            | 10262|01   | A                    | 10262|01 Product 15       |
| Product 31    | Portfolio 1 |          |           |            | 10847|01   | A                    | 10847|01 Product 31       |
| Product 34    | Portfolio 1 |          |           |            | 10872|01   | A                    | 10872|01 Product 34       |
| Product 35    | Portfolio 1 |          |           |            | 10873|01   | A                    | 10873|01 Product 35       |


Table: Order Size
|   MinValue |   MaxValue |   SortOrder | Order Size    |
|-----------:|-----------:|------------:|:--------------|
|          0 |     99.99  |           1 | $0-99         |
|        100 |    499.99  |           2 | $100-499      |
|        500 |    999.99  |           3 | $500-999      |
|       1000 |   4999.99  |           4 | $1,000-4,999  |
|       5000 |  25000     |           5 | $5,000-24,999 |
|      25000 |      1e+08 |           6 | $25,000+      |


Table: Orders
|   Cust_Nbr | So_Date                 | Ship_Comp   | Div_Code   | Date_Closed             | Rma_Nbr   | Ship_To_Name   | Ship_To_City   | Ship_To_State   | Ship_To_Zip   | Ship_To_Address1   | Ship_To_Address2   |   Ship_Cust_Nbr |   DomesticBin | Sales Rep   |   SO Nbr | Order Type   | Order Entry Person   | Promotion Code   | Catalog Source   | Order Status   |   Order Total | Telephone   | Email   | Bid Number   |
|-----------:|:------------------------|:------------|:-----------|:------------------------|:----------|:---------------|:---------------|:----------------|:--------------|:-------------------|:-------------------|----------------:|--------------:|:------------|---------:|:-------------|:---------------------|:-----------------|:-----------------|:---------------|--------------:|:------------|:--------|:-------------|
|     102442 | 2019-12-06 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          102442 |             1 | CAT         |   757024 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     104555 | 2019-12-18 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          104555 |             1 | CAT         |   757990 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     225960 | 2019-12-20 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          225960 |             1 | CAT         |   758175 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     225964 | 2020-01-02 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          225964 |             1 | CAT         |   758196 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     103690 | 2019-12-20 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          103690 |             1 | CAT         |   758198 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     210794 | 2019-12-20 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          210794 |             1 | CAT         |   758203 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     112163 | 2019-12-20 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          112163 |             1 | CAT         |   758207 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     225971 | 2020-01-02 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          225971 |             1 | CAT         |   758211 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     225972 | 2020-01-02 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          225972 |             1 | CAT         |   758213 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |
|     225149 | 2019-12-21 00:00:00.000 | N           | PIT        | 2020-01-02 00:00:00.000 |           |                |                |                 |               |                    |                    |          225149 |             1 | CAT         |   758214 | I            | WEB                  |                  | I                | C              |             1 |             |         |              |


Table: Portfolios
| Portfolio   |
|:------------|
| Portfolio 1 |
| Portfolio 2 |
| Portfolio 3 |
| Portfolio 4 |
| Portfolio 5 |
| Portfolio 6 |
| Portfolio 7 |


Table: Rep Names
| Rep   | Email           | Name   |   Is Manager | Direct   | Active   |
|:------|:----------------|:-------|-------------:|:---------|:---------|
| AES   |                 | AES    |            0 | True     | True     |
| AK    | AK@company.com  | AK     |            0 | True     | True     |
| AMZ   |                 | AMZ    |            0 | True     | True     |
| BB    | BB@company.com  | BB     |            1 | True     | True     |
| BGT   |                 | MOS    |            0 | True     | True     |
| CAT   |                 | CAT    |            0 | False    | True     |
| CEM   | CEM@company.com | CEM    |            0 | True     | True     |
| CSR   |                 | CSR    |            0 | False    | True     |
| DES   |                 | DES    |            0 | True     | True     |
| DP    |                 | DP     |            0 | True     | True     |


Table: Sales Price Code
| Revenue Bucket   | Sales Price Code   | Descripion M2K   | Description NP   | Revenue Type   |
|:-----------------|:-------------------|:-----------------|:-----------------|:---------------|
| HCO-1            | 1                  |                  |                  | Sales          |
| PEC-1            | 1                  |                  |                  | Sales          |
| PEC-12           | 12                 |                  |                  | Sales          |
| PEC-CSG          | CSG                |                  |                  | Other Income   |
| PEC-D&I          | D&I                |                  |                  | Other Income   |
| PEC-ND           | ND                 |                  |                  | Sales          |
| PEC-NW           | NW                 |                  |                  | Other Income   |
| PEC-PFI          | PFI                |                  |                  | Other Income   |
| PEC-PI           | PI                 |                  |                  | Other Income   |
| PEC-S            | S                  |                  |                  | Other Income   |


Table: Territories
| Country Code   | ST   | State                 | Area   | Region   | C/S Rep   | P/A Rep   | Independent Rep   |
|:---------------|:-----|:----------------------|:-------|:---------|:----------|:----------|:------------------|
| CAN            | SK   | Saskatchewan          | Canada | Canada   | AK        | TA        |                   |
| CAN            | ON   | Ontario               | Canada | Canada   | AK        | TA        |                   |
| CAN            | MB   | Manitoba              | Canada | Canada   | AK        | TA        |                   |
| CAN            | PE   | Prince Edward Island  | Canada | Canada   | AK        | TA        |                   |
| CAN            | QC   | Quebec                | Canada | Canada   | AK        | TA        |                   |
| CAN            | NU   | Nunavut               | Canada | Canada   | AK        | TA        |                   |
| CAN            | NB   | New Brunswick         | Canada | Canada   | AK        | TA        |                   |
| CAN            | NT   | Northwest Territories | Canada | Canada   | AK        | TA        |                   |
| CAN            | NS   | Nova Scotia           | Canada | Canada   | AK        | TA        |                   |
| CAN            | BC   | British Columbia      | Canada | Canada   | AK        | TA        |                   |

 


tables: name: Billing
data: Billing.csv
name: Customers
data: Customers.csv
name: Dates
data: Dates.csv
name: Goals
data: Goals.csv
name: Items
data: Items.csv
name: Order Size
data: Order Size.csv
name: Orders
data: Orders.csv
name: Portfolios
data: Portfolios.csv
name: Rep Names
data: Rep Names.csv
name: Sales Price Code
data: Sales Price Code.csv
name: Territories
data: Territories.csv
label: Orders
DomesticBin
Order Size
SortOrder
Customers
State
Territories
ST
Orders
Sales Rep
Rep Names
Rep
Billing
RevenueBucket
Sales Price Code
Revenue Bucket
Billing
Cust_Nbr
Customers
Cust_Nbr
Goals
Salesperson
Rep Names
Rep
Goals
Portfolio
Portfolios
Portfolio
Items
Portfolio
Portfolios
Portfolio
output: {
    "joins": [
        {
            "from_table": "Orders",
            "from_column": "DomesticBin",
            "to_table": "Order Size",
            "to_column": "SortOrder"
        },
        {
            "from_table": "Customers",
            "from_column": "State",
            "to_table": "Territories",
            "to_column": "ST"
        },
        {
            "from_table": "Orders",
            "from_column": "Sales Rep",
            "to_table": "Rep Names",
            "to_column": "Rep"
        },
        {
            "from_table": "Billing",
            "from_column": "RevenueBucket",
            "to_table": "Sales Price Code",
            "to_column": "Revenue Bucket"
        },
        {
            "from_table": "Billing",
            "from_column": "Cust_Nbr",
            "to_table": "Customers",
            "to_column": "Cust_Nbr"
        },
        {
            "from_table": "Goals",
            "from_column": "Salesperson",
            "to_table": "Rep Names",
            "to_column": "Rep"
        },
        {
            "from_table": "Goals",
            "from_column": "Portfolio",
            "to_table": "Portfolios",
            "to_column": "Portfolio"
        },
        {
            "from_table": "Items",
            "from_column": "Portfolio",
            "to_table": "Portfolios",
            "to_column": "Portfolio"
        }
    ]
}