0% completed
Converting an ER (Entity-Relationship) diagram to a relational model involves translating entities, attributes, and relationships into relational database tables. This process ensures that the structure defined in the ER diagram is accurately represented in a relational database, allowing data to be organized efficiently and consistently. In this lesson, we will convert an Employee Management System ER diagram into a relational model by following structured steps.
Based on the ER diagram provided, let’s go through each step to convert it into the relational model.
Each entity in the ER diagram is converted into a table. In our Employee Management System, we have two main entities:
Each table will have columns corresponding to the attributes of the respective entity, with one or more columns designated as primary keys to uniquely identify records.
The Employee entity has several attributes, which will be converted into columns in the Employee table. Here's the table structure:
Column Name | Data Type | Description |
---|---|---|
Employee_ID | INT (PK) | Primary key for each employee |
First_Name | VARCHAR | First name of the employee |
Middle_Initial | CHAR | Middle initial of the employee |
Last_Name | VARCHAR | Last name of the employee |
Birthdate | DATE | Date of birth of the employee |
Gender | CHAR | Gender of the employee |
Address | VARCHAR | Address of the employee |
Position | VARCHAR | Job position/title of the employee |
Special Handling:
The Payroll entity will be converted into the Payroll table with the following structure:
Column Name | Data Type | Description |
---|---|---|
Payroll_ID | INT (FK) | Primary key |
Employee_ID | INT (FK) | Foreign key linking to Employee table |
Monthly_Salary | DECIMAL | Monthly salary of the employee |
Cash_Advance | DECIMAL | Cash advance taken by the employee |
Tax | DECIMAL | Taxes that should be paid by employee. |
Special Handling:
Multivalued attributes need to be represented in separate tables to maintain the relational model structure. This step ensures that each unique value has its own row, preventing data redundancy.
To store multiple contact numbers for each employee, we create an Employee_Contact table, where each row represents a single contact number associated with an employee.
Column Name | Data Type | Description |
---|---|---|
Employee_ID | INT (FK) | Foreign key linking to Employee table |
Contact_Number | VARCHAR | Contact number of the employee |
After completing the conversion, our relational model for the Employee Management System will have the following tables:
Employee Table:
Payroll Table:
Employee_Contact Table:
Here is the final relational diagram for the Employee Management System.
.....
.....
.....