{
  "format": "dataset-manifest/1",
  "slug": "library-lending",
  "version": 1,
  "seed": "library-lending:1",
  "spec": {
    "format": "dataset/1",
    "slug": "library-lending",
    "name": "Library Lending",
    "tagline": "Branches, members, catalogue items, loans, and holds from a public library system.",
    "description": "Public libraries serve communities by providing access to books, media, and resources. This synthetic dataset models the operations of a public library, capturing the details of its branches, members, catalogue items, loans, and holds. Each table is designed to interrelate, allowing users to analyze how different elements of library services work together. The branches table holds information about library locations, while the members table tracks individual patrons. The catalogue items table consists of various titles available for loan, and each title may have multiple copies. The loans table records the transactions of items being borrowed, including due dates and return dates. Finally, the holds table allows members to reserve items currently checked out. This dataset is synthetic, ensuring that users can practice data analysis without concerns about privacy or real-world inconsistencies. Users can explore questions like how loan patterns vary by branch, which titles are frequently held, and how many items are overdue. It's ideal for SQL practice and creating BI dashboards.",
    "domain": "government",
    "shape": "transactional",
    "useCases": [
      "teaching",
      "bi-dashboards"
    ],
    "keywords": [
      "library",
      "lending",
      "loans",
      "holds",
      "members",
      "catalogue",
      "branches"
    ],
    "locale": "en",
    "license": "CC0-1.0",
    "version": 1,
    "tables": {
      "branches": {
        "description": "This table contains information about library branches, including location and contact details. Each row represents a unique branch.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each branch."
          },
          "name": {
            "kind": "fullName",
            "description": "The name of the library branch."
          },
          "address": {
            "kind": "sentence",
            "description": "The full address of the branch.",
            "nullable": true
          },
          "phone": {
            "kind": "phone",
            "description": "Contact phone number for the branch.",
            "nullable": true
          }
        }
      },
      "members": {
        "description": "This table holds records of library members, tracking their personal information and membership status. Each row corresponds to a unique member.",
        "rows": 100,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each member."
          },
          "full_name": {
            "kind": "fullName",
            "description": "The full name of the member."
          },
          "email": {
            "kind": "email",
            "from": "full_name",
            "description": "Email address of the member.",
            "nullable": true
          },
          "join_date": {
            "kind": "date",
            "from": "2023-01-01",
            "to": "2024-12-31",
            "description": "The date the member joined the library.",
            "nullable": true
          },
          "is_active": {
            "kind": "bool",
            "trueRate": 0.9,
            "description": "Indicates if the member's account is active.",
            "nullable": true
          }
        }
      },
      "catalogue_items": {
        "description": "This table contains information about items available in the library's catalogue, such as books, DVDs, and magazines. Each title may have multiple copies.",
        "rows": 200,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each catalogue item."
          },
          "title": {
            "kind": "sentence",
            "description": "The title of the item."
          },
          "author": {
            "kind": "words",
            "description": "The author of the item.",
            "nullable": true,
            "when": {
              "column": "item_type",
              "in": [
                "book",
                "dvd"
              ]
            }
          },
          "item_type": {
            "kind": "enum",
            "values": [
              "book",
              "dvd",
              "magazine"
            ],
            "description": "The type of item."
          },
          "available_copies": {
            "kind": "int",
            "min": 0,
            "max": 20,
            "description": "The number of copies available for loan.",
            "nullable": true
          }
        }
      },
      "loans": {
        "description": "This table tracks the loan transactions of catalogue items, including which member borrowed which item and due dates for return. Each row corresponds to a loan.",
        "rows": 300,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each loan."
          },
          "member_id": {
            "kind": "fk",
            "ref": "members.id",
            "description": "Reference to the member who borrowed the item."
          },
          "item_id": {
            "kind": "fk",
            "ref": "catalogue_items.id",
            "description": "Reference to the borrowed item."
          },
          "loan_date": {
            "kind": "date",
            "from": "2023-01-01",
            "to": "2024-12-31",
            "description": "The date the item was borrowed."
          },
          "due_date": {
            "kind": "date",
            "after": "loan_date",
            "withinDays": 14,
            "description": "The date by which the item must be returned."
          },
          "return_date": {
            "kind": "date",
            "after": "due_date",
            "withinDays": 30,
            "description": "The date the item was returned, null if not yet returned.",
            "nullable": true
          }
        }
      },
      "holds": {
        "description": "This table records holds placed by members for items currently checked out. Each row represents a hold request.",
        "rows": 150,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each hold."
          },
          "member_id": {
            "kind": "fk",
            "ref": "members.id",
            "description": "Reference to the member who placed the hold."
          },
          "item_id": {
            "kind": "fk",
            "ref": "catalogue_items.id",
            "description": "Reference to the item being held."
          },
          "placed_date": {
            "kind": "date",
            "from": "2023-01-01",
            "to": "2024-12-31",
            "description": "The date the hold was placed.",
            "nullable": true,
            "when": {
              "column": "status",
              "in": [
                "fulfilled",
                "canceled"
              ]
            }
          },
          "status": {
            "kind": "enum",
            "values": [
              "active",
              "fulfilled",
              "canceled"
            ],
            "description": "The current status of the hold."
          }
        }
      }
    },
    "structure": "multi-table",
    "traits": [
      "categorical",
      "timestamped",
      "nullable"
    ],
    "analysisQuestions": [
      "What is the average loan duration for items across different branches?",
      "Which items have the highest number of holds placed?",
      "How does member activity vary through the year?",
      "Are there certain times when loans tend to be overdue more frequently?"
    ],
    "suggestedQueries": [
      {
        "title": "Join Members and Loans",
        "sql": "SELECT m.full_name, l.loan_date FROM members m JOIN loans l ON m.id = l.member_id;",
        "dialect": "postgres"
      },
      {
        "title": "Count Loans by Branch",
        "sql": "SELECT b.name, COUNT(l.id) FROM branches b JOIN loans l ON b.id = l.branch_id GROUP BY b.name;",
        "dialect": "postgres"
      },
      {
        "title": "Items with Overdue Loans",
        "sql": "SELECT c.title, COUNT(l.id) FROM catalogue_items c JOIN loans l ON c.id = l.item_id WHERE l.return_date IS NULL AND l.due_date < CURRENT_DATE GROUP BY c.title;",
        "dialect": "postgres"
      },
      {
        "title": "Monthly Loan Trends",
        "sql": "SELECT DATE_TRUNC('month', l.loan_date) AS month, COUNT(l.id) FROM loans l GROUP BY month ORDER BY month;",
        "dialect": "postgres"
      }
    ],
    "usageScenarios": [
      {
        "title": "Library Management Reporting",
        "body": "Library administrators can use this dataset to generate reports on lending patterns, track member engagement, and monitor overdue items. This information helps in making informed decisions about resource allocation and improving member services."
      },
      {
        "title": "Teaching SQL Concepts",
        "body": "Instructors can utilize this dataset in academic settings to teach students SQL querying techniques. The variety of tables and relationships provides a practical context for learning joins, aggregations, and data analysis."
      },
      {
        "title": "Business Intelligence Dashboard Creation",
        "body": "Data analysts can leverage this dataset to create dashboards that visualize library usage metrics. By integrating data from various tables, analysts can present insights on member activity, popular items, and branch performance."
      }
    ]
  },
  "counts": {
    "branches": 10,
    "catalogue_items": 200,
    "members": 100,
    "holds": 150,
    "loans": 300
  },
  "stats": {
    "branches": {
      "rows": 10,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 10,
          "min": 1,
          "max": 10
        },
        "name": {
          "nulls": 0,
          "distinct": 10,
          "min": "Carla Bennett",
          "max": "Selin Taylor"
        },
        "address": {
          "nulls": 0,
          "distinct": 10
        },
        "phone": {
          "nulls": 0,
          "distinct": 10
        }
      }
    },
    "members": {
      "rows": 100,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 100,
          "min": 1,
          "max": 100
        },
        "full_name": {
          "nulls": 0,
          "distinct": 97,
          "min": "Ana Costa",
          "max": "Zoe Sousa"
        },
        "email": {
          "nulls": 10,
          "distinct": 90
        },
        "join_date": {
          "nulls": 14,
          "distinct": 82,
          "min": "2023-01-02",
          "max": "2024-12-19"
        },
        "is_active": {
          "nulls": 9,
          "distinct": 2,
          "min": "false",
          "max": "true"
        }
      }
    },
    "catalogue_items": {
      "rows": 200,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 200,
          "min": 1,
          "max": 200
        },
        "title": {
          "nulls": 0,
          "distinct": 200
        },
        "author": {
          "nulls": 62,
          "distinct": 138
        },
        "item_type": {
          "nulls": 0,
          "distinct": 3,
          "min": "book",
          "max": "magazine"
        },
        "available_copies": {
          "nulls": 18,
          "distinct": 21,
          "min": 0,
          "max": 20
        }
      }
    },
    "loans": {
      "rows": 300,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 300,
          "min": 1,
          "max": 300
        },
        "member_id": {
          "nulls": 0,
          "distinct": 94,
          "min": 1,
          "max": 100
        },
        "item_id": {
          "nulls": 0,
          "distinct": 156,
          "min": 1,
          "max": 200
        },
        "loan_date": {
          "nulls": 0,
          "distinct": 254,
          "min": "2023-01-06",
          "max": "2024-12-23"
        },
        "due_date": {
          "nulls": 0,
          "distinct": 235,
          "min": "2023-01-08",
          "max": "2025-01-04"
        },
        "return_date": {
          "nulls": 36,
          "distinct": 231,
          "min": "2023-01-18",
          "max": "2025-01-23"
        }
      }
    },
    "holds": {
      "rows": 150,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 150,
          "min": 1,
          "max": 150
        },
        "member_id": {
          "nulls": 0,
          "distinct": 77,
          "min": 1,
          "max": 100
        },
        "item_id": {
          "nulls": 0,
          "distinct": 107,
          "min": 2,
          "max": 200
        },
        "placed_date": {
          "nulls": 58,
          "distinct": 87,
          "min": "2023-01-16",
          "max": "2024-12-28"
        },
        "status": {
          "nulls": 0,
          "distinct": 3,
          "min": "active",
          "max": "fulfilled"
        }
      }
    }
  },
  "artifacts": [
    {
      "file": "csv/branches.csv",
      "format": "csv",
      "table": "branches",
      "key": "datasets/library-lending/v1/csv/branches.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/csv/branches.csv",
      "bytes": 832,
      "sha256": "bf4246629d8d22a21775583ec0fd965e231ce453d89374152b47c381e103092e",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/catalogue_items.csv",
      "format": "csv",
      "table": "catalogue_items",
      "key": "datasets/library-lending/v1/csv/catalogue_items.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/csv/catalogue_items.csv",
      "bytes": 17663,
      "sha256": "db8d0ef2967b2fa8c36982800a6f2fb934f6336a295471e0d268ba0da4a35781",
      "rows": 200,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/members.csv",
      "format": "csv",
      "table": "members",
      "key": "datasets/library-lending/v1/csv/members.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/csv/members.csv",
      "bytes": 5195,
      "sha256": "533f5117d5f877dc5b134c3345ff32b2d771b0c54d724d59e08a68d9af8bbaf3",
      "rows": 100,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/holds.csv",
      "format": "csv",
      "table": "holds",
      "key": "datasets/library-lending/v1/csv/holds.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/csv/holds.csv",
      "bytes": 3989,
      "sha256": "038b7e7c154fdc81799f7f67c2b67035d9432bf0fcaee8abd94b7256e0a7cd47",
      "rows": 150,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/loans.csv",
      "format": "csv",
      "table": "loans",
      "key": "datasets/library-lending/v1/csv/loans.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/csv/loans.csv",
      "bytes": 12907,
      "sha256": "cfe29f4ccc8abbaa3f9916dfd204299b982ee217612fde51f56d266ddf4199f2",
      "rows": 300,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "library-lending.json",
      "format": "json",
      "table": null,
      "key": "datasets/library-lending/v1/library-lending.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/library-lending.json",
      "bytes": 128708,
      "sha256": "084d5d7d2a3047e7c4e23fa33098828ad98e6934c9ed63f25fc5a2a7cfc345f7",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/library-lending/v1/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/sql/postgres.sql",
      "bytes": 55688,
      "sha256": "0d37264e18dd172c84cb2e293f99d3d44a4106fb4bd065a780cb16e06a2fc2bf",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/library-lending/v1/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/sql/mysql.sql",
      "bytes": 54857,
      "sha256": "bc7b7f86f5636aa0507067864108bbfa28a679b4b8b199231c9689c88253b0ee",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/library-lending/v1/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/sql/mssql.sql",
      "bytes": 57130,
      "sha256": "5e630dd1be4f36b92de80497f5dba486134d54df5ede6d9a5f048374d29071bd",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/library-lending/v1/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/sql/sqlite.sql",
      "bytes": 54698,
      "sha256": "3dddc08467731e3aebab698a0218e1b2e39b78c45ed6b1afccdfaf8b61e77799",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/library-lending/v1/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/prisma/seed.ts",
      "bytes": 99943,
      "sha256": "f46121aec311fefc5ac7c5c5706c0c08dc06fa4b2f6fed97786c9055851c855a",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/library-lending/v1/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/library-lending/v1/django/fixtures.json",
      "bytes": 159088,
      "sha256": "5a13bee45f942ffc57170525d4f9bd2ad7769a66a7194e4a397d40e2f6d07477",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "publishedAt": 1788766964711,
  "updatedAt": 1788766964711
}
