LAB 1
LAB 1
creating, populating the tables. To understand the concept of data constraints that is
enforced on data being stored in the table. Focus on Primary Key and the Foreign Key.
TABLE 1: EMPLOYEE
Minit CHAR,
Bdate DATE,
Address VARCHAR(30),
Sex CHAR,
Salary DECIMAL(10,2),
Super_ssn CHAR(9),
TABLE 2: DEPARTMENT
Mgr_start_date DATE,
UNIQUE (Dname),
FOREIGN KEY (Mgr_ssn) REFERENCES EMPLOYEE(Ssn) );
TABLE 3: DEPT_LOCATIONS
TABLE 4: PROJECT
Plocation VARCHAR(15),
UNIQUE (Pname),
TABLE 5: WORKS_ON
TABLE 6: DEPENDENT
Sex CHAR,
Bdate DATE,
Relationship VARCHAR(8),
b. Insert the following data into their respective tables of Company database.
DEPARTMENT
EMPLOYEE
731
1965- Fondren,
John Smith 123456789 M 30000 333445555 5
01-09 Houston
TX
638 Voss,
1965-
Franklin Wong 333445555 Houston M 40000 888665555 5
12-08
TX
3321
1968-
Alicia Zelaya 999887777 Castle, F 25000 987654321 4
01-19
Spring TX
291 Berry,
1941-
Jennifer Wallace 987654321 Bellaire F 43000 888665555 4
06-20
TX
975 Fire
1962- Oak,
Ramesh Narayan 666884444 M 38000 333445555 5
09-15 Humble
TX
5631 Rice,
1972-
Joyce English 453453453 Houston F 25000 333445555 5
07-31
TX
980
1969- Dallas,
Ahmad Jabbar 987987987 M 25000 987654321 4
03-29 Houston
TX
450
1937- Stone,
James Borg 888665555 M 55000 null 1
11-10 Houston
TX
PROJECT
ProductX 1 Bellaire 5
ProductY 2 Sugarland 5
ProductZ 3 Houston 5
Computerization 10 Stafford 4
Reorganization 20 Houston 1
Newbenefits 30 Stafford 4
WORKS_ON
123456789 2 7.5
666884444 3 40.0
453453453 1 20.0
453453453 2 20.0
333445555 2 10.0
333445555 3 10.0
333445555 10 10.0
333445555 20 10.0
999887777 30 30.0
999887777 10 10.0
987987987 10 35.0
987987987 30 5.0
987654321 30 20.0
987654321 20 15.0
888665555 20 null
DEPENDENT
DEPT_LOCATIONS
DNUMBER DLOCATION
1 Houston
4 Stafford
5 Bellaire
5 Houston
5 Sugarland