ER diagram for payroll management system
This ER diagram models a simple payroll management system. It has five tables: departments, employees, salaries, attendance and leaves, with employees at the centre. It suits students preparing a DBMS project and developers sketching a first payroll database.

Example: ER diagram for payroll management system: click to open it in the editor and change it.
Entities and key attributes
Each table has an integer id as its primary key. The tables that depend on an employee store an employee_id foreign key.
| Entity | Primary key | Other attributes |
|---|---|---|
| departments | id | name |
| employees | id | name, email, department_id (FK), joined_date |
| salaries | id | employee_id (FK), basic, hra, deductions, month |
| attendance | id | employee_id (FK), date, status |
| leaves | id | employee_id (FK), from_date, to_date, status |
Relationships and cardinality
- employees → departments (N:1): many employees belong to one department through department_id.
- salaries → employees (N:1): one employee has many salary records, one per month.
- attendance → employees (N:1): one employee has many daily attendance rows, each with a date and a status.
- leaves → employees (N:1): one employee can have many leave requests, each with a from_date, a to_date and a status.
Every relationship is one-to-many and points toward employees. Monthly pay can be worked out from salaries (basic + hra − deductions) and checked against attendance and approved leaves.
How to adapt it for your project
- Add a net_pay or payment_date column to salaries if you need to store the final payout.
- Add a designation or manager_id column to employees for reporting lines.
- Add a leave_type column to leaves (sick, casual, paid) if leave rules differ by type.
- Add a unique constraint on (employee_id, month) in salaries so an employee cannot be paid twice for the same month.
Tip: In this diagram, salaries.basic is typed VARCHAR while hra and deductions are DECIMAL. Change basic to DECIMAL so pay calculations work without type conversions. Open and edit it before you generate SQL.
Frequently asked questions
What are the entities in an ER diagram for a payroll management system?
This diagram has five entities: departments, employees, salaries, attendance and leaves. Employees is the central entity that the other tables link to.
What is the relationship between employee and salary in a payroll ER diagram?
It is one-to-many. One employee has many salary records, one for each month, linked by the employee_id foreign key in salaries.
How is attendance connected to payroll in this ER diagram?
The attendance table stores a date and a status for each employee, linked through employee_id. You can count present days per month and use that count when you calculate deductions in the salaries table.
Make your own ER diagram with AI →