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: AgingTable
|   Index | AgingGroup       |   Min |   Max |
|--------:|:-----------------|------:|------:|
|       1 | Age 0-30 Days    |     1 |    30 |
|       2 | Age 31-60 Days   |    31 |    60 |
|       3 | Age 61-90 Days   |    61 |    90 |
|       4 | Age 91-1000 Days |    91 |  1000 |


Table: ARInvoiceBalances
|   InvoiceID | CurrencyCode   |   InvoiceAmount |
|------------:|:---------------|----------------:|
|      835093 | AED            |           32720 |
|      835050 | AED            |            3020 |
|      835079 | AED            |            3020 |
|      835144 | AED            |            3195 |
|      835176 | AED            |            3635 |
|      835181 | AED            |            3815 |
|      835185 | AED            |          164488 |
|      835186 | AED            |             280 |
|      835187 | AED            |            1995 |
|      835189 | AED            |            5425 |


Table: ARInvoiceDetails
|   InvoiceID |   InvoiceDetailID | CurrencyCode   | Column                  |
|------------:|------------------:|:---------------|:------------------------|
|      835093 |           2140690 | AED            | 2020-02-06 00:00:00.000 |
|      835050 |           2140691 | AED            | 2020-02-29 00:00:00.000 |
|      835079 |           2276549 | AED            | 2020-03-08 00:00:00.000 |
|      835144 |           2276550 | AED            | 2020-03-16 00:00:00.000 |
|      835176 |           2276551 | AED            | 2020-03-24 00:00:00.000 |
|      835181 |           2276552 | AED            | 2020-03-17 00:00:00.000 |
|      835185 |           2163434 | AED            | 2020-03-21 00:00:00.000 |
|      835186 |           2163435 | AED            | 2020-03-25 00:00:00.000 |
|      835187 |           2163436 | AED            | 2020-03-29 00:00:00.000 |
|      835189 |           2279932 | AED            | 2020-05-02 00:00:00.000 |


Table: ARInvoices
| InvoiceDate             |   InvoiceID |   InvoiceNumber |   ProfileNumber | ProfileName   |   InvoiceAmount | DueDate                 |
|:------------------------|------------:|----------------:|----------------:|:--------------|----------------:|:------------------------|
| 2020-01-01 00:00:00.000 |      835093 |          748034 |        13000169 | AAli          |           32720 | 2020-02-15 00:00:00.000 |
| 2020-01-03 00:00:00.000 |      835050 |          748038 |          103900 | AIGSA         |            3020 | 2020-02-15 00:00:00.000 |
| 2020-01-05 00:00:00.000 |      835079 |          748066 |          104900 | CARZ          |            3020 | 2020-03-01 00:00:00.000 |
| 2020-01-07 00:00:00.000 |      835144 |          748118 |         1301500 | CBM           |            3195 | 2020-03-01 00:00:00.000 |
| 2020-01-09 00:00:00.000 |      835176 |          748022 |         1301500 | CBM           |            3635 | 2020-03-01 00:00:00.000 |
| 2020-01-11 00:00:00.000 |      835181 |          748023 |         1301500 | CBM           |            3815 | 2020-03-01 00:00:00.000 |
| 2020-01-13 00:00:00.000 |      835185 |          748024 |         1301500 | CBM           |          164488 | 2020-03-01 00:00:00.000 |
| 2020-01-15 00:00:00.000 |      835186 |          748025 |         1301500 | CBM           |             280 | 2020-03-01 00:00:00.000 |
| 2020-01-17 00:00:00.000 |      835187 |          748026 |         1301500 | CBM           |            1995 | 2020-03-17 00:00:00.000 |
| 2020-01-19 00:00:00.000 |      835189 |          748083 |         1301500 | CBM           |            5425 | 2020-03-17 00:00:00.000 |


Table: Calendar
| Date                    |
|:------------------------|
| 2019-07-01 00:00:00.000 |
| 2019-07-02 00:00:00.000 |
| 2019-07-03 00:00:00.000 |
| 2019-07-04 00:00:00.000 |
| 2019-07-05 00:00:00.000 |
| 2019-07-06 00:00:00.000 |
| 2019-07-07 00:00:00.000 |
| 2019-07-08 00:00:00.000 |
| 2019-07-09 00:00:00.000 |
| 2019-07-10 00:00:00.000 |


Table: CashReceipt
|   InvoiceDetailID |   ProfileNumber | ReceiptDate             |
|------------------:|----------------:|:------------------------|
|           2140690 |        13000169 | 2020-02-06 00:00:00.000 |
|           2140691 |          103900 | 2020-02-29 00:00:00.000 |
|           2276549 |          104900 | 2020-03-08 00:00:00.000 |
|           2276550 |         1301500 | 2020-03-16 00:00:00.000 |
|           2276551 |         1301500 | 2020-03-24 00:00:00.000 |
|           2276552 |         1301500 | 2020-03-17 00:00:00.000 |
|           2163434 |         1301500 | 2020-03-21 00:00:00.000 |
|           2163435 |         1301500 | 2020-03-25 00:00:00.000 |
|           2163436 |         1301500 | 2020-03-29 00:00:00.000 |
|           2279932 |         1301500 | 2020-05-02 00:00:00.000 |


Table: CashReceiptInvoices
|   InvoiceID |   InvoiceNumber |   AmountPaid |
|------------:|----------------:|-------------:|
|      835093 |          748034 |        32720 |
|      835050 |          748038 |         3020 |
|      835079 |          748066 |         3020 |
|      835144 |          748118 |         3195 |
|      835176 |          748022 |         3635 |
|      835181 |          748023 |         3815 |
|      835185 |          748024 |       164488 |
|      835186 |          748025 |          280 |
|      835187 |          748026 |         1995 |
|      835189 |          748083 |         5425 |


Table: ClientDetail
|   ProfileNumber |   CreditDays | StatementGroup   |
|----------------:|-------------:|:-----------------|
|             100 |           30 | F                |
|          102500 |           45 | F                |
|          102501 |           45 | F                |
|          102502 |           45 | F                |
|          102506 |           45 | F                |
|          103900 |           30 | F                |
|          104500 |           30 | M                |
|          104900 |           30 | M                |
|          106200 |           30 | M                |
|          107300 |           60 | M                |

 


tables: name: AgingTable
data: AgingTable.csv
name: ARInvoiceBalances
data: ARInvoiceBalances.csv
name: ARInvoiceDetails
data: ARInvoiceDetails.csv
name: ARInvoices
data: ARInvoices.csv
name: Calendar
data: Calendar.csv
name: CashReceipt
data: CashReceipt.csv
name: CashReceiptInvoices
data: CashReceiptInvoices.csv
name: ClientDetail
data: ClientDetail.csv
label: ARInvoices
ProfileNumber
ClientDetail
ProfileNumber
ARInvoiceDetails
InvoiceID
ARInvoices
InvoiceID
CashReceipt
InvoiceDetailID
ARInvoiceDetails
InvoiceDetailID
ARInvoices
InvoiceID
CashReceiptInvoices
InvoiceID
output: {
    "joins": [
        {
            "from_table": "ARInvoices",
            "from_column": "ProfileNumber",
            "to_table": "ClientDetail",
            "to_column": "ProfileNumber"
        },
        {
            "from_table": "ARInvoiceDetails",
            "from_column": "InvoiceID",
            "to_table": "ARInvoices",
            "to_column": "InvoiceID"
        },
        {
            "from_table": "CashReceipt",
            "from_column": "InvoiceDetailID",
            "to_table": "ARInvoiceDetails",
            "to_column": "InvoiceDetailID"
        },
        {
            "from_table": "ARInvoices",
            "from_column": "InvoiceID",
            "to_table": "CashReceiptInvoices",
            "to_column": "InvoiceID"
        }
    ]
}