{
  "format": "dataset-manifest/1",
  "slug": "billing-insights",
  "version": 4,
  "seed": "billing-insights:1",
  "engine": 1,
  "engineVersion": "1.0.0",
  "spec": {
    "format": "dataset/1",
    "slug": "billing-insights",
    "name": "Billing Insights",
    "tagline": "Invoices, payments, vendors, credit notes, and payment methods for financial transactions in fintech.",
    "description": "Vendors submit invoices while companies process payments, creating a cycle of financial transactions that is essential in fintech. This bill management system allows businesses to maintain accurate records and streamline their operations. Each invoice represents a request for payment from a vendor, while payments indicate the completion of these transactions. The payments table links directly to the invoices, revealing which invoices have been settled and which are outstanding. Vendors are tied to invoices through a direct relationship, showcasing the suppliers that companies rely on for their goods or services.\n\nCredit notes offer a method for tracking adjustments or refunds related to invoices, providing a deeper insight into the financial interactions between a business and its vendors. The relationship between credit notes and invoices allows users to see how adjustments impact overall billing and cash flow. Additionally, payment methods detail how transactions are conducted, whether through credit cards, bank transfers, or other financial instruments, linking back to the payments table to highlight user preferences in settling their bills.\n\nData from this system answers critical questions regarding payment timelines, vendor reliability, and the effectiveness of different payment methods. Developers looking to practice can explore trends in payment behavior, identify patterns in vendor selection, and analyze the impact of credit notes on the overall financial health of an organization. By working with these tables, users can gain proficiency in SQL joins, aggregate functions, and financial analysis, enabling them to effectively manipulate and interpret data in a real-world context. It's important to note that this dataset is synthetic, designed to provide realistic scenarios without the complexities of real-world data.",
    "domain": "fintech",
    "shape": "ledger",
    "useCases": [
      "sql-practice",
      "teaching"
    ],
    "keywords": [
      "billing",
      "fintech",
      "invoices",
      "payments",
      "vendors",
      "credit notes",
      "financial transactions",
      "data analysis"
    ],
    "locale": "en",
    "license": "CC0-1.0",
    "version": 1,
    "tables": {
      "invoices": {
        "description": "Each row represents a unique invoice issued to a vendor, linking to payment records and credit notes as needed.",
        "rows": {
          "per": "vendors",
          "via": "vendor_id",
          "min": 5,
          "max": 15,
          "skew": "long-tail"
        },
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for the invoice."
          },
          "vendor_id": {
            "kind": "fk",
            "ref": "vendors.id",
            "description": "Reference to the vendor issuing the invoice."
          },
          "amount": {
            "kind": "decimal",
            "min": 100,
            "max": 10000,
            "scale": 2,
            "description": "Total amount of the invoice.",
            "distribution": "long-tail"
          },
          "issue_date": {
            "kind": "date",
            "from": "2022-01-01",
            "to": "2023-12-31",
            "description": "Date when the invoice was issued.",
            "trend": "seasonal"
          },
          "due_date": {
            "kind": "date",
            "after": "issue_date",
            "withinDays": 30,
            "description": "Date by which the invoice should be paid."
          },
          "status": {
            "kind": "enum",
            "values": [
              "paid",
              "pending",
              "overdue"
            ],
            "description": "Current status of the invoice.",
            "weights": [
              8,
              2,
              1
            ]
          }
        }
      },
      "payments": {
        "description": "This table records payments made against invoices, detailing amounts, dates, and methods of payment.",
        "rows": {
          "per": "invoices",
          "via": "invoice_id",
          "min": 1,
          "max": 3,
          "skew": "long-tail"
        },
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for the payment."
          },
          "invoice_id": {
            "kind": "fk",
            "ref": "invoices.id",
            "description": "Reference to the associated invoice."
          },
          "amount": {
            "kind": "decimal",
            "min": 1,
            "max": 10000,
            "scale": 2,
            "description": "Amount paid towards the invoice.",
            "distribution": "long-tail"
          },
          "payment_date": {
            "kind": "date",
            "from": "2022-01-01",
            "to": "2023-12-31",
            "description": "Date when the payment was made.",
            "trend": "growing"
          },
          "payment_method_id": {
            "kind": "fk",
            "ref": "payment_methods.id",
            "description": "Reference to the payment method used."
          },
          "payment_status": {
            "kind": "enum",
            "values": [
              "completed",
              "pending",
              "failed"
            ],
            "weights": [
              70,
              20,
              10
            ],
            "description": "Current status of the payment."
          },
          "currency": {
            "kind": "enum",
            "values": [
              "USD",
              "EUR",
              "GBP"
            ],
            "weights": [
              50,
              30,
              20
            ],
            "description": "Currency in which the payment was made."
          }
        }
      },
      "vendors": {
        "description": "This table contains a list of vendors that provide goods or services, linked to invoices and payments.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for the vendor."
          },
          "name": {
            "kind": "company",
            "description": "Name of the vendor."
          },
          "contact_email": {
            "kind": "email",
            "from": "name",
            "description": "Email address for vendor communications."
          },
          "phone": {
            "kind": "phone",
            "description": "Contact phone number for the vendor."
          }
        }
      },
      "credit_notes": {
        "description": "Represents adjustments made to invoices, providing a record of credit issued.",
        "rows": {
          "per": "invoices",
          "via": "invoice_id",
          "min": 0,
          "max": 2,
          "skew": "long-tail"
        },
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for the credit note."
          },
          "invoice_id": {
            "kind": "fk",
            "ref": "invoices.id",
            "description": "Reference to the invoice being adjusted."
          },
          "amount": {
            "kind": "decimal",
            "min": 1,
            "max": 5000,
            "scale": 2,
            "description": "Amount credited back to the invoice.",
            "distribution": "long-tail"
          },
          "issue_date": {
            "kind": "date",
            "from": "2022-01-01",
            "to": "2023-12-31",
            "description": "Date when the credit note was issued.",
            "trend": "seasonal"
          },
          "reason": {
            "kind": "enum",
            "values": [
              "refund",
              "adjustment",
              "discount"
            ],
            "weights": [
              50,
              30,
              20
            ],
            "description": "Reason for issuing the credit note."
          },
          "related_invoice_amount": {
            "kind": "decimal",
            "min": 1,
            "max": 5000,
            "distribution": "long-tail",
            "description": "Amount related to the invoice that the credit note adjusts."
          }
        }
      },
      "payment_methods": {
        "description": "Categorizes the different payment methods available for processing payments.",
        "rows": 5,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for the payment method."
          },
          "method_name": {
            "kind": "enum",
            "values": [
              "credit_card",
              "bank_transfer",
              "paypal",
              "crypto",
              "cash"
            ],
            "description": "Name of the payment method.",
            "weights": [
              5,
              3,
              2,
              1,
              1
            ]
          },
          "processing_time": {
            "kind": "int",
            "min": 1,
            "max": 5,
            "distribution": "normal",
            "description": "Time in days for the payment method to process a transaction."
          },
          "transaction_fee": {
            "kind": "decimal",
            "min": 0.5,
            "max": 2.5,
            "distribution": "long-tail",
            "description": "Fee charged for processing a transaction using this payment method."
          }
        }
      }
    },
    "structure": "multi-table",
    "traits": [
      "monetary",
      "timestamped",
      "nullable"
    ],
    "analysisQuestions": [
      "What is the average amount of invoices issued per vendor?",
      "How frequently are payments made relative to due dates?",
      "Which payment methods are most commonly used?",
      "How often are credit notes issued compared to total invoices?",
      "Which vendors have the highest outstanding payments?"
    ],
    "suggestedQueries": [
      {
        "title": "Join Invoices and Payments",
        "sql": "SELECT invoices.id, invoices.amount, payments.amount AS payment_amount FROM invoices JOIN payments ON invoices.id = payments.invoice_id;",
        "dialect": "postgres"
      },
      {
        "title": "Aggregate Payments by Method",
        "sql": "SELECT payment_methods.method_name, SUM(payments.amount) AS total_paid FROM payments JOIN payment_methods ON payments.payment_method_id = payment_methods.id GROUP BY payment_methods.method_name;",
        "dialect": "postgres"
      },
      {
        "title": "Count Invoices by Status",
        "sql": "SELECT status, COUNT(*) AS invoice_count FROM invoices GROUP BY status;",
        "dialect": "postgres"
      },
      {
        "title": "Invoices with Credit Notes",
        "sql": "SELECT invoices.id, credit_notes.amount AS credit_amount FROM invoices LEFT JOIN credit_notes ON invoices.id = credit_notes.invoice_id WHERE credit_notes.amount IS NOT NULL;",
        "dialect": "postgres"
      }
    ],
    "usageScenarios": [
      {
        "title": "Financial Analysts",
        "body": "Financial analysts can utilize this dataset to assess the efficiency of a company's bill management. By analyzing payment frequencies and the status of invoices, they can derive insights that help improve cash flow management and vendor relationships, optimizing financial operations."
      },
      {
        "title": "Educators and Trainers",
        "body": "Educators can use this dataset in training programs for students learning about financial management and SQL. By providing realistic scenarios that simulate real-world billing processes, students can practice writing queries, understanding relationships between tables, and deriving meaningful insights from data."
      },
      {
        "title": "Developers",
        "body": "Developers can leverage this dataset to test and refine their application interfaces for bill management systems. By working with a well-structured dataset, they can build features that handle invoices, payments, and credit notes while ensuring that their applications can scale and handle various user interactions."
      }
    ]
  },
  "counts": {
    "payment_methods": 5,
    "vendors": 10,
    "invoices": 95,
    "credit_notes": 61,
    "payments": 154
  },
  "stats": {
    "invoices": {
      "rows": 95,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 95,
          "min": 1,
          "max": 95
        },
        "vendor_id": {
          "nulls": 0,
          "distinct": 10,
          "min": 1,
          "max": 10
        },
        "amount": {
          "nulls": 0,
          "distinct": 95,
          "min": 100.62,
          "max": 9985.03
        },
        "issue_date": {
          "nulls": 0,
          "distinct": 91,
          "min": "2022-01-10",
          "max": "2023-12-21"
        },
        "due_date": {
          "nulls": 0,
          "distinct": 90,
          "min": "2022-01-14",
          "max": "2024-01-15"
        },
        "status": {
          "nulls": 0,
          "distinct": 3,
          "min": "overdue",
          "max": "pending"
        }
      }
    },
    "payments": {
      "rows": 154,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 154,
          "min": 1,
          "max": 154
        },
        "invoice_id": {
          "nulls": 0,
          "distinct": 95,
          "min": 1,
          "max": 95
        },
        "amount": {
          "nulls": 0,
          "distinct": 154,
          "min": 8.62,
          "max": 9999.31
        },
        "payment_date": {
          "nulls": 0,
          "distinct": 142,
          "min": "2022-01-01",
          "max": "2023-12-29"
        },
        "payment_method_id": {
          "nulls": 0,
          "distinct": 5,
          "min": 1,
          "max": 5
        },
        "payment_status": {
          "nulls": 0,
          "distinct": 3,
          "min": "completed",
          "max": "pending"
        },
        "currency": {
          "nulls": 0,
          "distinct": 3,
          "min": "EUR",
          "max": "USD"
        }
      }
    },
    "vendors": {
      "rows": 10,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 10,
          "min": 1,
          "max": 10
        },
        "name": {
          "nulls": 0,
          "distinct": 10,
          "min": "Beacon Group",
          "max": "Willow Foods"
        },
        "contact_email": {
          "nulls": 0,
          "distinct": 10
        },
        "phone": {
          "nulls": 0,
          "distinct": 10
        }
      }
    },
    "credit_notes": {
      "rows": 61,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 61,
          "min": 1,
          "max": 61
        },
        "invoice_id": {
          "nulls": 0,
          "distinct": 42,
          "min": 1,
          "max": 93
        },
        "amount": {
          "nulls": 0,
          "distinct": 61,
          "min": 1.03,
          "max": 4639.3
        },
        "issue_date": {
          "nulls": 0,
          "distinct": 60,
          "min": "2022-01-03",
          "max": "2023-12-27"
        },
        "reason": {
          "nulls": 0,
          "distinct": 3,
          "min": "adjustment",
          "max": "refund"
        },
        "related_invoice_amount": {
          "nulls": 0,
          "distinct": 61,
          "min": 1.37,
          "max": 4920.84
        }
      }
    },
    "payment_methods": {
      "rows": 5,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 5,
          "min": 1,
          "max": 5
        },
        "method_name": {
          "nulls": 0,
          "distinct": 3,
          "min": "bank_transfer",
          "max": "crypto"
        },
        "processing_time": {
          "nulls": 0,
          "distinct": 3,
          "min": 2,
          "max": 4
        },
        "transaction_fee": {
          "nulls": 0,
          "distinct": 5,
          "min": 0.98,
          "max": 2.34
        }
      }
    }
  },
  "artifacts": [
    {
      "file": "csv/payment_methods.csv",
      "format": "csv",
      "table": "payment_methods",
      "key": "datasets/billing-insights/v4/csv/payment_methods.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/csv/payment_methods.csv",
      "bytes": 155,
      "sha256": "7db90f8e03e3dc8e7c21572d3b31ed91911538085c479dd3ac8a2323d55b4246",
      "rows": 5,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/vendors.csv",
      "format": "csv",
      "table": "vendors",
      "key": "datasets/billing-insights/v4/csv/vendors.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/csv/vendors.csv",
      "bytes": 610,
      "sha256": "721763276bde759ed147b5474d8b3fc3a920ea1a1538a860cda0360e558df34f",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/invoices.csv",
      "format": "csv",
      "table": "invoices",
      "key": "datasets/billing-insights/v4/csv/invoices.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/csv/invoices.csv",
      "bytes": 3980,
      "sha256": "f41ff2e4bba549471653b81634621ee8a0125986dc3471cfe822ca9f81012f1a",
      "rows": 95,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/credit_notes.csv",
      "format": "csv",
      "table": "credit_notes",
      "key": "datasets/billing-insights/v4/csv/credit_notes.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/csv/credit_notes.csv",
      "bytes": 2597,
      "sha256": "f2ab190c133caa95eacf240eb622e9325e8a4d82407608d89636a341f4221336",
      "rows": 61,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/payments.csv",
      "format": "csv",
      "table": "payments",
      "key": "datasets/billing-insights/v4/csv/payments.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/csv/payments.csv",
      "bytes": 6401,
      "sha256": "4214e2308c1ff8593dcf0f7414426bbea18594a826ab08c8b3abfded03290969",
      "rows": 154,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "billing-insights.json",
      "format": "json",
      "table": null,
      "key": "datasets/billing-insights/v4/billing-insights.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/billing-insights.json",
      "bytes": 60134,
      "sha256": "c0afdc2e1aadc407c3e95202258b2be8cffe40f29f69e449087d0c4c20d35e68",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/billing-insights/v4/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/sql/postgres.sql",
      "bytes": 22060,
      "sha256": "c5353a4156bd0583696745aca9bf868c4e9f9fa7a0961b8c04bbe1c6b8f55d96",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/billing-insights/v4/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/sql/mysql.sql",
      "bytes": 21489,
      "sha256": "980dfed168ae91793228d42c739c5813a3b94ffba463e94da20158092365e4ca",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/billing-insights/v4/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/sql/mssql.sql",
      "bytes": 22726,
      "sha256": "8017dffc7c1753c85b7fa427425c9b757f02128bec4da44b0ba054b3fea01ff1",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/billing-insights/v4/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/sql/sqlite.sql",
      "bytes": 21283,
      "sha256": "982f2ce3f5827a5d7e4673c173d37dc452a9946dcfff014b831dae09986eebdf",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/billing-insights/v4/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/prisma/seed.ts",
      "bytes": 46564,
      "sha256": "a47d4f9c88394bab9459ef87cfb30ed5d56c2ed0908d4e656794f5b6c7408f16",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/billing-insights/v4/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/billing-insights/v4/django/fixtures.json",
      "bytes": 73933,
      "sha256": "5c118885942f3cee1566818626ea676839ad76e3bf1127725cc994049b9704e4",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "publishedAt": 1788768422730,
  "updatedAt": 1789095650907
}
