Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Management System Quiz 1. A company needs to store information about: the employees identified by EmpNo, Name, Salary and Phone; departments.

Similar presentations


Presentation on theme: "Database Management System Quiz 1. A company needs to store information about: the employees identified by EmpNo, Name, Salary and Phone; departments."— Presentation transcript:

1 Database Management System Quiz 1

2 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.

3 Employee EmpNo Name Salary Department DeptNo Name Budegt Child NameAge Works in M 1 has M 1 1 1 Manage

4 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)


Download ppt "Database Management System Quiz 1. A company needs to store information about: the employees identified by EmpNo, Name, Salary and Phone; departments."

Similar presentations


Ads by Google