Database Management System Quiz 1. A company needs to store information about: the employees...
-
Upload
terence-briggs -
Category
Documents
-
view
215 -
download
1
Transcript of Database Management System Quiz 1. A company needs to store information about: the employees...
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 information2. Translate the ER into relational model.
Employee
EmpNoName
Salary
Department
DeptNoName
Budegt
Child
Name Age
Works in M 1
has
M
1
1 1Manage
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 EMPLOYEESOn Delete CASCADE)
Create table MANAGE(EMPNO integer,DEPTNO integer,Primary Key (EMPNO, DEPTNO),Foreign Key (EMPNO) References EMPLOYEES,Foreign Key (DEPTNO) References DEPARTMENTs)