Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Populate the Company Database. Using the data on page 162 of your text, insert a

ID: 3869662 • Letter: P

Question

Populate the Company Database.

Using the data on page 162 of your text, insert all data into your database relations.

You may verify results by entering SELECT * FROM EMPLOYEE, then printing the result. Do this for each relation in the database.

162 Chapter 5 The Relational Data Model and Relational Database Constraints Figure 5.6 One possible database state for the COMPANY relational database schema. EMPLOYEE Fname MinitLname Bdate Address Sex Salary Super_ssn Dno B Smith 1234567891965-01-09 731 Fondren, Houston, TX M 30000 3334455555 Franklin T Wong 3334455551955-12-08 638 Voss, Houston, TX M 40000 8886655555 J Zelaya 999887777 1968-01-19 3321 Castle, Spring, TX F 25000 987654321 4 F 43000 888665555 4 Ramesh K Narayan 666884444 1962-09-15 975 Fire Oak, Humble, TX M 38000 3334455555 Joyce A English 453453453 1972-07-31 5631 Rice, Houston, TX F 25000 333445555 5 AhmadVJabbar 9879879871969-03-29 980 Dallas, Houston, TX M 25000 987654321 4 sn JenniferS Wallace 987654321 1941-06-20 291 Berry, Bellaire, TX James EBorg 888665555 1937-11-10 450 Stone, Houston, TX M 55000NULL DEPARTMENT DEPT_LOCATIONS Dnumber Dlocation Houstorn Stafford Dnumber Research Administration Headquarters Mgr ssn 333445555 987654321 888665555 Mgr start date 1988-05-22 1995-01-01 1981-06-19 4 Sugarland Houston WORKS_ON PROJECT Hours Pname Pnumber Plocation Dnum ProductX ProductY ProductZ Computerization10Stafford Reorganization Newbenefits Bellaire 123456789 123456789 666884444 453453453 453453453 333445555 333445555 333445555 333445555 999887777 999887777 987987987 987987987 987654321 987654321 888665555 32.5 Sugarland 40.0 3 Houston 20.0 4 Houston 10.0 10.0 10.0 Stafford 4 3 DEPENDENT sn ent_name Sex Bdate Relationship 30.0 333445555 333445555 Theodore 333445555 Joy 987654321 123456789 123456789 123456789 Elizabeth Alice F 1986-04-05Daughter M 1983-10-25 Son F 1958-05-03 Spouse M 1942-02-28 Spouse M 1988-01-04 Son F 1988-12-30 Daughter F 1967-05-05Spouse 35.0 20.0 Michael NULL

Explanation / Answer

Inserting Into Department Table:

Insert Into Department values('Research',5,333445555,'1988-05-22')

Insert Into Departmentvalues('Administration',4,987654321,'1995-01-01')

Insert Into Departmentvalues('Headquaters',1,888665555,'1981-06-19')

Inserting Into DeptLocations Table:

Insert Into Dept_Locations values(1,'Houston')

Insert Into Dept_Locations values(4,'Stanfford')

Insert Into Dept_Locations values(5,'Bellaire')

Insert Into Dept_Locations values(5,'Sugarland')

Insert Into Dept_Locations values(5,'Houston')


Inserting Into Project Table:

Insert Into Project Values('ProductX',1,'Bellaire',5)


Insert Into Project Values('ProductY',2,'Sugarland',5)

Insert Into Project Values('ProductZ',3,'Houston',5)

Insert Into Project Values('Computerization',10,'Stafford',4)

Insert Into Project Values('Reorganization',20,'Houston',1)

Insert Into Project Values('Newbenefits',30,'Stafford',4)

Inserting Into Works_On Table:

Insert Into Works_On Values(123456789,1,32.5)

Insert Into Works_On Values(123456789,2,7.5)

Insert Into Works_On Values(666884444,3,40.0)

Insert Into Works_On Values(453453453,1,20.0)

Insert Into Works_On Values(453453453,2,20.0)

Insert Into Works_On Values(333445555,2,10.0)

Insert Into Works_On Values(333445555,3,10.0)


Insert Into Works_On Values(333445555,10,10.0)


Insert Into Works_On Values(999887777,30,30.0)


Insert Into Works_On Values(999887777,10,10.0)

Insert Into Works_On Values(987987987,30,5.0)

Insert Into Works_On Values(987987987,30,20.0)

Insert Into Works_On Values(987654321,30,20.0)

Insert Into Works_On Values(987654321,20,15.0)

Insert Into Works_On Values(888665555,20,NULL)

Inserting Into Dependent Table:

Insert Into Dependent Values(333445555,'Alice','F','1986-04-05','Daughter')

Insert Into Dependent Values(333445555,'Theodore','M','1983-10-25','Son')

Insert Into Dependent Values(333445555,'Joy','F','1958-05-03','Spouse')

Insert Into Dependent Values(987654321,'Abner','M','1942-02-28','Spouse')

Insert Into Dependent Values(123456789,'Michael','M','1988-01-04','Son')

Insert Into Dependent Values(123456789,'Alice','F','1988-12-30','Daughter')

Insert Into Dependent Values(123456789,'Elizabeth','F','1967-05-05','Spouse')


Inserting Into Employee Table:

Insert Into Employee Values('Jhon','B','Smith',123456789,'1965-01-09','731 Fondren,Houston,Tx','M',30000,333445555,5)

Insert Into Employee('Franklin','T','Wong',333445555,'1955-12-08','638 Voss,Houston,Tx','M',40000,888665555,5)