{
  "format": "dataset-manifest/1",
  "slug": "employees-and-payroll",
  "version": 1,
  "seed": "employees-and-payroll:1",
  "spec": {
    "format": "dataset/1",
    "slug": "employees-and-payroll",
    "name": "Employees and Payroll",
    "tagline": "Employee records, departments, positions, salary history, leave requests, and payroll data from an HR system.",
    "description": "An HR system serves as the backbone for managing employees across various departments, enabling efficient tracking of positions, payroll, and leave requests. This synthetic dataset captures the intricate relationships between employees and their departments, managers, and salary history, allowing users to simulate real-world HR operations. With six distinct tables, you can explore the employee hierarchy, monitor payroll changes over time, and analyze leave requests efficiently. Each table is designed to answer specific queries, such as understanding departmental structures, tracking salary adjustments, and managing employee leave. This dataset is perfect for practicing SQL skills and ORM seeding, providing a rich environment for developers and analysts alike.",
    "domain": "hr",
    "shape": "transactional",
    "useCases": [
      "orm-seeding",
      "sql-practice"
    ],
    "keywords": [
      "hr",
      "employees",
      "payroll",
      "departments",
      "salary",
      "leave requests",
      "management"
    ],
    "locale": "en",
    "license": "CC0-1.0",
    "version": 1,
    "tables": {
      "employees": {
        "description": "This table records each employee's basic details, including their position and department, linking to their manager in the hierarchy.",
        "rows": 500,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each employee."
          },
          "full_name": {
            "kind": "fullName",
            "description": "The full name of the employee."
          },
          "email": {
            "kind": "email",
            "from": "full_name",
            "description": "The employee's email address."
          },
          "position_id": {
            "kind": "fk",
            "ref": "positions.id",
            "description": "References the employee's position."
          },
          "department_id": {
            "kind": "fk",
            "ref": "departments.id",
            "description": "References the department the employee belongs to."
          },
          "manager_id": {
            "kind": "fk",
            "ref": "employees.id",
            "nullable": true,
            "description": "References the employee's manager, allowing for hierarchical relationships."
          }
        }
      },
      "departments": {
        "description": "This table holds information about different departments within the organization.",
        "rows": 10,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each department."
          },
          "name": {
            "kind": "words",
            "description": "The name of the department."
          },
          "location": {
            "kind": "city",
            "description": "The location of the department."
          }
        }
      },
      "positions": {
        "description": "This table defines various job positions available within the organization, linked to employee roles.",
        "rows": 25,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each position."
          },
          "title": {
            "kind": "words",
            "description": "The title of the job position."
          },
          "salary_range": {
            "kind": "decimal",
            "min": 40000,
            "max": 200000,
            "scale": 2,
            "description": "The salary range for this position."
          }
        }
      },
      "salary_history": {
        "description": "This table tracks the salary history for each employee, allowing for auditing of changes over time.",
        "rows": 1000,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each salary record."
          },
          "employee_id": {
            "kind": "fk",
            "ref": "employees.id",
            "description": "References the employee whose salary is recorded."
          },
          "salary": {
            "kind": "decimal",
            "min": 40000,
            "max": 200000,
            "scale": 2,
            "description": "The salary amount at the time of the record."
          },
          "effective_date": {
            "kind": "date",
            "from": "2020-01-01",
            "to": "2023-12-31",
            "description": "The date when this salary became effective.",
            "trend": "growing"
          }
        }
      },
      "leave_requests": {
        "description": "This table records leave requests submitted by employees, including their statuses.",
        "rows": 300,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each leave request."
          },
          "employee_id": {
            "kind": "fk",
            "ref": "employees.id",
            "description": "References the employee who submitted the leave request."
          },
          "start_date": {
            "kind": "date",
            "from": "2021-01-01",
            "to": "2023-12-31",
            "description": "The start date of the leave.",
            "trend": "seasonal"
          },
          "end_date": {
            "kind": "date",
            "from": "2021-01-01",
            "to": "2023-12-31",
            "description": "The end date of the leave.",
            "trend": "seasonal"
          },
          "status": {
            "kind": "enum",
            "values": [
              "approved",
              "pending",
              "rejected"
            ],
            "description": "The current status of the leave request."
          }
        }
      },
      "payroll": {
        "description": "This table captures monthly payroll runs for all employees, detailing their earnings and deductions.",
        "rows": 600,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each payroll record."
          },
          "employee_id": {
            "kind": "fk",
            "ref": "employees.id",
            "description": "References the employee for whom payroll is processed."
          },
          "pay_period_start": {
            "kind": "date",
            "from": "2021-01-01",
            "to": "2023-12-31",
            "description": "The start date of the payroll period.",
            "trend": "growing"
          },
          "pay_period_end": {
            "kind": "date",
            "from": "2021-01-01",
            "to": "2023-12-31",
            "description": "The end date of the payroll period.",
            "trend": "growing"
          },
          "gross_pay": {
            "kind": "decimal",
            "min": 2000,
            "max": 20000,
            "scale": 2,
            "description": "Total earnings before deductions."
          },
          "net_pay": {
            "kind": "decimal",
            "min": 1500,
            "max": 18000,
            "scale": 2,
            "description": "Total earnings after deductions."
          }
        }
      }
    },
    "structure": "multi-table",
    "traits": [
      "categorical",
      "timestamped",
      "monetary",
      "self-referencing"
    ],
    "analysisQuestions": [
      "What is the average salary per department?",
      "How many leave requests are approved compared to those rejected?",
      "What is the trend of salary changes over the years?",
      "Which positions have the highest average salaries?",
      "How does employee turnover affect payroll budgets?"
    ],
    "suggestedQueries": [
      {
        "title": "Join Employees and Departments",
        "sql": "SELECT e.full_name, d.name FROM employees e JOIN departments d ON e.department_id = d.id;",
        "dialect": "postgres"
      },
      {
        "title": "Average Salary by Position",
        "sql": "SELECT p.title, AVG(s.salary) FROM positions p JOIN salary_history s ON p.id = s.employee_id GROUP BY p.title;",
        "dialect": "postgres"
      },
      {
        "title": "Leave Request Status Count",
        "sql": "SELECT status, COUNT(*) FROM leave_requests GROUP BY status;",
        "dialect": "postgres"
      },
      {
        "title": "Monthly Payroll Summary",
        "sql": "SELECT pay_period_start, SUM(gross_pay) AS total_gross, SUM(net_pay) AS total_net FROM payroll GROUP BY pay_period_start ORDER BY pay_period_start;",
        "dialect": "postgres"
      },
      {
        "title": "Employee Hierarchy",
        "sql": "WITH RECURSIVE employee_tree AS (SELECT id, full_name, manager_id FROM employees WHERE manager_id IS NULL UNION ALL SELECT e.id, e.full_name, e.manager_id FROM employees e JOIN employee_tree et ON e.manager_id = et.id) SELECT * FROM employee_tree;",
        "dialect": "postgres"
      }
    ],
    "usageScenarios": [
      {
        "title": "Payroll Management",
        "body": "HR managers can use this dataset to simulate monthly payroll runs, analyze gross and net pay trends, and ensure compliance with salary regulations. By practicing SQL queries on payroll data, they can refine their skills in financial reporting and analysis."
      },
      {
        "title": "Employee Management",
        "body": "Recruiters and HR professionals can utilize this dataset to manage employee records, analyze leave requests, and monitor departmental performance. They can run queries to track employee hierarchy and ensure that departments are adequately staffed."
      },
      {
        "title": "Salary Analysis",
        "body": "Data analysts can leverage this dataset to explore salary trends across positions and departments. By querying the salary history and conducting statistical analysis, they can provide insights into compensation strategies and workforce planning."
      },
      {
        "title": "Leave Management",
        "body": "This dataset enables HR teams to analyze leave requests and their outcomes, providing insights into employee well-being and departmental workload management. By querying request statuses and trends, they can enhance leave policies and planning."
      }
    ]
  },
  "counts": {
    "departments": 10,
    "positions": 25,
    "employees": 500,
    "leave_requests": 300,
    "payroll": 600,
    "salary_history": 1000
  },
  "stats": {
    "employees": {
      "rows": 500,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 500,
          "min": 1,
          "max": 500
        },
        "full_name": {
          "nulls": 0,
          "distinct": 472,
          "min": "Alice Becker",
          "max": "Zoe Zhang"
        },
        "email": {
          "nulls": 0,
          "distinct": 490
        },
        "position_id": {
          "nulls": 0,
          "distinct": 25,
          "min": 1,
          "max": 25
        },
        "department_id": {
          "nulls": 0,
          "distinct": 10,
          "min": 1,
          "max": 10
        },
        "manager_id": {
          "nulls": 47,
          "distinct": 239,
          "min": 1,
          "max": 492
        }
      }
    },
    "departments": {
      "rows": 10,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 10,
          "min": 1,
          "max": 10
        },
        "name": {
          "nulls": 0,
          "distinct": 10
        },
        "location": {
          "nulls": 0,
          "distinct": 9,
          "min": "Bangkok",
          "max": "Warsaw"
        }
      }
    },
    "positions": {
      "rows": 25,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 25,
          "min": 1,
          "max": 25
        },
        "title": {
          "nulls": 0,
          "distinct": 25
        },
        "salary_range": {
          "nulls": 0,
          "distinct": 25,
          "min": 48847.89,
          "max": 198316.81
        }
      }
    },
    "salary_history": {
      "rows": 1000,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 1000,
          "min": 1,
          "max": 1000
        },
        "employee_id": {
          "nulls": 0,
          "distinct": 439,
          "min": 1,
          "max": 499
        },
        "salary": {
          "nulls": 0,
          "distinct": 1000,
          "min": 40251.1,
          "max": 199589.39
        },
        "effective_date": {
          "nulls": 0,
          "distinct": 707,
          "min": "2020-01-03",
          "max": "2023-12-30"
        }
      }
    },
    "leave_requests": {
      "rows": 300,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 300,
          "min": 1,
          "max": 300
        },
        "employee_id": {
          "nulls": 0,
          "distinct": 228,
          "min": 2,
          "max": 496
        },
        "start_date": {
          "nulls": 0,
          "distinct": 256,
          "min": "2021-01-01",
          "max": "2023-12-30"
        },
        "end_date": {
          "nulls": 0,
          "distinct": 259,
          "min": "2021-01-02",
          "max": "2023-12-30"
        },
        "status": {
          "nulls": 0,
          "distinct": 3,
          "min": "approved",
          "max": "rejected"
        }
      }
    },
    "payroll": {
      "rows": 600,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 600,
          "min": 1,
          "max": 600
        },
        "employee_id": {
          "nulls": 0,
          "distinct": 363,
          "min": 1,
          "max": 500
        },
        "pay_period_start": {
          "nulls": 0,
          "distinct": 464,
          "min": "2021-01-01",
          "max": "2023-12-29"
        },
        "pay_period_end": {
          "nulls": 0,
          "distinct": 460,
          "min": "2021-01-03",
          "max": "2023-12-30"
        },
        "gross_pay": {
          "nulls": 0,
          "distinct": 600,
          "min": 2002.94,
          "max": 19887.64
        },
        "net_pay": {
          "nulls": 0,
          "distinct": 600,
          "min": 1520.89,
          "max": 17993.77
        }
      }
    }
  },
  "artifacts": [
    {
      "file": "csv/departments.csv",
      "format": "csv",
      "table": "departments",
      "key": "datasets/employees-and-payroll/v1/csv/departments.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/csv/departments.csv",
      "bytes": 368,
      "sha256": "4be0c02bed2ccd150877833b1db92415c5984cf86ccfc4a2acc06001360aed09",
      "rows": 10,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/positions.csv",
      "format": "csv",
      "table": "positions",
      "key": "datasets/employees-and-payroll/v1/csv/positions.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/csv/positions.csv",
      "bytes": 984,
      "sha256": "5fc4deefdcb0a3a03a96f276184b1c057ec56052d5b853f03f16d137c0a29521",
      "rows": 25,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/employees.csv",
      "format": "csv",
      "table": "employees",
      "key": "datasets/employees-and-payroll/v1/csv/employees.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/csv/employees.csv",
      "bytes": 24570,
      "sha256": "6fffc498028dd50f42826641c1b0c31c1181f30d499696001c618b080521f6da",
      "rows": 500,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/leave_requests.csv",
      "format": "csv",
      "table": "leave_requests",
      "key": "datasets/employees-and-payroll/v1/csv/leave_requests.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/csv/leave_requests.csv",
      "bytes": 11772,
      "sha256": "91d9b3027aa17d4fd5d75ef9db795d6fd0eb2629f75058ac9c10be7bfaf1075e",
      "rows": 300,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/payroll.csv",
      "format": "csv",
      "table": "payroll",
      "key": "datasets/employees-and-payroll/v1/csv/payroll.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/csv/payroll.csv",
      "bytes": 28663,
      "sha256": "0281a8f1fb497bf6b85286101e7c60d0f261559d4038adf222e460f6c9cd1c9b",
      "rows": 600,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/salary_history.csv",
      "format": "csv",
      "table": "salary_history",
      "key": "datasets/employees-and-payroll/v1/csv/salary_history.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/csv/salary_history.csv",
      "bytes": 29330,
      "sha256": "61d8f14a589963ff1560d7f2dbd3242e92721aa62eb7d49f8482286db1ba1499",
      "rows": 1000,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "employees-and-payroll.json",
      "format": "json",
      "table": null,
      "key": "datasets/employees-and-payroll/v1/employees-and-payroll.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/employees-and-payroll.json",
      "bytes": 369905,
      "sha256": "5471d5aa0fb466297dbf441b71e0544afc78931d154d2799e3aec5282be7e24f",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/employees-and-payroll/v1/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/sql/postgres.sql",
      "bytes": 132681,
      "sha256": "cc799d0ce100ddd6db1969c762f27b0cb02f2f6e40c742b79cc48f8c066c81de",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/employees-and-payroll/v1/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/sql/mysql.sql",
      "bytes": 131986,
      "sha256": "77c4213ebf3f4432658a1eea8565c7fec3b5aac318d7d2833c8daaf16d097c8a",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/employees-and-payroll/v1/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/sql/mssql.sql",
      "bytes": 136535,
      "sha256": "60afc4c21c7b3e9986efa455b969e0f0ca698ed23482ab026e1b4d4fc3f76a6e",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/employees-and-payroll/v1/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/sql/sqlite.sql",
      "bytes": 131710,
      "sha256": "750a4246edb2b730322b68d94d192c91fbcd18b42714a6860062921b95e74fee",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/employees-and-payroll/v1/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/prisma/seed.ts",
      "bytes": 287901,
      "sha256": "6358c90698c8ca3e9a5e810839b61e7a0a0f2706c54fba8e0e7670cafb011e4c",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/employees-and-payroll/v1/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/employees-and-payroll/v1/django/fixtures.json",
      "bytes": 479523,
      "sha256": "77e8dfc8e62042a3ae81f34a97285573b937bd0fd25556d6d1053cf91be5b99f",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "publishedAt": 1788768684288,
  "updatedAt": 1788768684288
}
