1) Draw an E-R diagram of Company and design database tables applying normalization? Explain the Relationships.
a. Entity Name -> Employee, Department, Projects, Leave, Salary, Dependents.
Answers
Answer:
ER Diagram of a Company
ER Diagram is known as Entity-Relationship Diagram, it is used to analyze to structure of the Database. It shows relationships between entities and their attributes. An ER Model provides a means of communication.
ER diagram of Company has the following description :
Company has several departments.
Each department may have several Location.
Departments are identified by a name, D_no, Location.
A Manager control a particular department.
Each department is associated with number of projects.
Employees are identified by name, id, address, dob, dat e_of_joining.
An employee works in only one department but can work on several project.
We also keep track of number of hours worked by an employee on a single project.
Each employee has dependent
Dependent has D_name, Gender and relationship.
This Company ER diagram illustrates key information about Company, including entities such as employee, department, project and dependent. It allows to understand the relationships between entities.
Entities and their Attributes are
Employee Entity : Attributes of Employee Entity are Name, Id, Address, Gender, Dob and Doj.
Id is Primary Key for Employee Entity.
Department Entity : Attributes of Department Entity are D_no, Name and Location.
D_no is Primary Key for Department Entity.
Project Entity : Attributes of Project Entity are P_No, Name and Location.
P_No is Primary Key for Project Entity.
Dependent Entity : Attributes of Dependent Entity are D_no, Gender and relationship.
Relationships are :
Employees works in Departments –
Many employee works in one Department but one employee can not work in many departments.
Manager controls a Department –
employee works under the manager of the Department and the manager records the date of joining of employee in the department.
Department has many Projects –
One department has many projects but one project can not come under many departments.
Employee works on project –
One employee works on several projects and the number of hours worked by the employee on a single project is recorded.
Employee has dependents –
Each Employee has dependents. Each dependent is dependent of only one employee.