Database Management System Quiz 1
A company needs to store information about: the employees identified by EmpNo, Name, Salary and Phone; departments identified by DeptNo, Name, and Budget; the children of an employee with name and age. Each employee works in only one department; each department is managed by an employee; a child must be identified uniquely by name when the parent (who is an employee; assume that only one parent works for the company and the employee may has more than one child) is known. We are not interested in information about a child once the parent leaves the company. 1.Draw an ER diagram that captures this information 2.Translate the ER into relational model.
Employee EmpNo Name Salary Department DeptNo Name Budegt Child NameAge Works in M 1 has M Manage
Create table EMPLOYEES( EMPNO integer, NAME char(20), SALARY float, DeptNo Integer, Primary Key (EMPNO), Foreign key (Deptno) References Departments) Create table DEPARTMENTS( DEPTNO integer, NAME char(20), BUDGET integer, Primary Key (DEPTNO)) Create table CHILD( EMPNO integer, NAME char(20), Primary Key (EMPNO,NAME), Foreign Key (EMPNO) References EMPLOYEES On Delete CASCADE) Create table MANAGE( EMPNO integer, DEPTNO integer, Primary Key (EMPNO, DEPTNO), Foreign Key (EMPNO) References EMPLOYEES, Foreign Key (DEPTNO) References DEPARTMENTs)