Back to template

Payroll / HR Database Schema Examples

These HR schema examples show how the same employee-salary-payroll core adapts to small businesses, hourly workforces, salaried teams with benefits, and multi-country payroll with local tax rules.

Payroll / HR Database Schema Examples

Real examples

Small business (the baseline)

Who uses it: Founder/HR building a first payroll system

Employee (id, name, email, hired_at, department_id, position_id)
Salary stored as history with effective dates
Monthly Payroll combining salary
LeaveRequest with vacation/sick types
No timesheets — salaried employees only

Why this works: Small business HR can skip timesheets for salaried staff — the diagram is simpler, but salary history is non-negotiable because past payrolls must reproduce exactly what was paid at the time.

Hourly workforce

Who uses it: Team with shift-based or hourly employees

Timesheet is central — gross pay = hours × hourly_rate
Salary table stores hourly_rate with effective dates
Overtime tracked separately with a multiplier
Shift table records scheduled hours vs worked hours
Payroll calculation runs per pay period from the timesheet

Why this works: Hourly workforces make Timesheet the source of truth for payroll — the diagram emphasizes the timesheet→payroll link, because hours worked drive gross pay and overtime rules are encoded into payroll calculation.

Salaried with benefits

Who uses it: Mid-size team with health insurance, 401k, and equity

Benefit (id, employee_id, type, provider, contribution)
Deductions added to Payroll for pre-tax benefits
Equity grants tracked separately with vesting schedule
Bonus and commission as additional Pay components
Tax withholding calculated from gross minus deductions

Why this works: Benefits add a layer of Pay components — the diagram extends Payroll with deductions for insurance, 401k, etc., because net pay isn't just gross minus tax once benefits enter the picture.

Multi-country payroll

Who uses it: Team with employees across jurisdictions

Employee gains a country_code and tax_id
Payroll calculation rule scoped per country
Currency stored on Salary and Payroll
Local statutory deductions per country (social security, etc.)
Compliance documents per employee per country

Why this works: Multi-country payroll demands per-country rules — the diagram adds country to Employee and forks payroll calculation by jurisdiction, because tax and statutory deductions vary fundamentally between countries.

Tips for better results

  • Always treat Salary as effective-dated history, never a column on Employee — a raise must not erase the old amount, or you lose the ability to re-run past payrolls.
  • Separate Timesheet from Payroll; hours are captured continuously, payroll is calculated periodically.
  • Put leave on its own table with type and status — vacation, sick, and unpaid all flow into payroll differently.
  • Store payroll line items (gross, tax, net, deductions) on the Payroll row itself, not derived at query time, so a statement matches forever.

Start editing online

Go back to the template, swap in your own content, and keep the same structure if it fits your project.

Use this template: /editor/new?template=payroll-hr-database-schema

Edit this HR schema template