a) Insert <'ProductA',4,'Bellaire',2> into PROJECT b) Insert <'Production',4,'943775543','1998-10-01'> into DEPARTMENT c) Insert <'677678989',NULL,'40.0'> into WORKS_ON d) Delete the PROJECT tuple with Pname='ProductX' e) Delete the DEPARTMENT tuple with Dnumber=4 f) Modify the Dnumber attribute of the DEPARTMENT tuple with Dnumber=4 to 2.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Assume that the following data definition statements for defining the COMPANY schema
(CompanySchema.pdf) are given.
CREATE TABLE EMPLOYEE (Fname VARCHAR(15), NOT NULL, Minit CHAR, Lname VARCHAR(15) NOT
NULL, Ssn CHAR(9) NOT NULL, Bdate DATE, Address VARCHAR(30), Sex CHAR, Salary DOUBLE, Super_ssn
CHAR (9), Dno INT NOT NULL DEFAULT 1,
PRIMARY KEY (Ssn),
FOREIGN KEY (Super ssn) REFERENCES EMPLOYEE(Ssn)
ON DELETE SET NULL
FOREIGN KEY (Dno) REFERENCES DEPARTMENT(Dnumber)
ON DELETE SET DEFAULT
ON UPDATE CASCADE,
ON UPDATE CASCADE);
CREATE TABLE DEPARTMENT (Dname VARCHAR(15) NOT NULL, Dnumber INT NOT NULL, Mgr_ssn CHAR(9)
NOT NULL DEFAULT '888665555', Mgr_start_date DATE,
PRIMARY KEY (Dnumber),
FOREIGN KEY (Mgr_ssn) REFERENCES EMPLOYEE(Ssn)
ON DELETE SET DEFAULT
ON UPDATE CASCADE);
CREATE TABLE DEPT LOCATIONS (Dnumber INT NOT NULL, Dlocation VARCHAR(15) NOT NULL,
PRIMARY KEY (Dnumber, Dlocation),
FOREIGN KEY (Dnumber) REFERENCES DEPARTMENT(Dnumber)
ON DELETE CASCADE
ON UPDATE CASCADE);
CREATE TABLE PROJECT (Pname VARCHAR(15) NOT NULL, Pnumber INT NOT NULL, Plocation
VARCHAR(15), Dnum INT NOT NULL DEFAULT 1,
PRIMARY KEY (Pnumber),
FOREIGN KEY (Dnum) REFERENCES DEPARTMENT (Dnumber)
ON DELETE SET DEFAULT
ON UPDATE CASCADE);
CREATE TABLE WORKS ON (Essn CHAR(9) NOT NULL, Pno INT NOT NULL DEFAULT 20, Hours DOUBLE
NOT NULL,
PRIMARY KEY (Essn, Pno),
FOREIGN KEY (Essn) REFERENCES EMPLOYEE(Ssn)
ON DELETE CASCADE
FOREIGN KEY (Pno) REFERENCES EMPLOYEE(Pnumber)
ON DELETE SET DEFAULT
ON UPDATE CASCADE);
ON UPDATE CASCADE);
CREATE TABLE DEPENDENT (Essn CHAR(9) NOT NULL,
Dependent_name VARCHAR(15) NOT NULL, Sex CHAR, Bdate DATE, Relationship VARCHAR(8),
PRIMARY KEY (Essn, Dependent_Name),
FOREIGN KEY (Essn) REFERENCES EMPLOYEE(ssn)
ON DELETE CASCADE
ON UPDATE
Suppose that each of the following update operations is applied independently to the database state
given in CompanySchema.pdf. For each operation, write the name of all constraints if any. Also, write
the reason for the violation. Write the new state of each table after each operation if the operation is
not restricted. Show only the updated tables.
a) Insert <'ProductA',4,'Bellaire',2> into PROJECT
b) Insert <'Production',4,'943775543','1998-10-01'> into DEPARTMENT
c) Insert <'677678989',NULL,'40.0'> into WORKS_ON
d) Delete the PROJECT tuple with Pname%='ProductX'
e) Delete the DEPARTMENT tuple with Dnumber=D4
f) Modify the Dnumber attribute of the DEPARTMENT tuple with Dnumber=4 to 2.
Transcribed Image Text:Assume that the following data definition statements for defining the COMPANY schema (CompanySchema.pdf) are given. CREATE TABLE EMPLOYEE (Fname VARCHAR(15), NOT NULL, Minit CHAR, Lname VARCHAR(15) NOT NULL, Ssn CHAR(9) NOT NULL, Bdate DATE, Address VARCHAR(30), Sex CHAR, Salary DOUBLE, Super_ssn CHAR (9), Dno INT NOT NULL DEFAULT 1, PRIMARY KEY (Ssn), FOREIGN KEY (Super ssn) REFERENCES EMPLOYEE(Ssn) ON DELETE SET NULL FOREIGN KEY (Dno) REFERENCES DEPARTMENT(Dnumber) ON DELETE SET DEFAULT ON UPDATE CASCADE, ON UPDATE CASCADE); CREATE TABLE DEPARTMENT (Dname VARCHAR(15) NOT NULL, Dnumber INT NOT NULL, Mgr_ssn CHAR(9) NOT NULL DEFAULT '888665555', Mgr_start_date DATE, PRIMARY KEY (Dnumber), FOREIGN KEY (Mgr_ssn) REFERENCES EMPLOYEE(Ssn) ON DELETE SET DEFAULT ON UPDATE CASCADE); CREATE TABLE DEPT LOCATIONS (Dnumber INT NOT NULL, Dlocation VARCHAR(15) NOT NULL, PRIMARY KEY (Dnumber, Dlocation), FOREIGN KEY (Dnumber) REFERENCES DEPARTMENT(Dnumber) ON DELETE CASCADE ON UPDATE CASCADE); CREATE TABLE PROJECT (Pname VARCHAR(15) NOT NULL, Pnumber INT NOT NULL, Plocation VARCHAR(15), Dnum INT NOT NULL DEFAULT 1, PRIMARY KEY (Pnumber), FOREIGN KEY (Dnum) REFERENCES DEPARTMENT (Dnumber) ON DELETE SET DEFAULT ON UPDATE CASCADE); CREATE TABLE WORKS ON (Essn CHAR(9) NOT NULL, Pno INT NOT NULL DEFAULT 20, Hours DOUBLE NOT NULL, PRIMARY KEY (Essn, Pno), FOREIGN KEY (Essn) REFERENCES EMPLOYEE(Ssn) ON DELETE CASCADE FOREIGN KEY (Pno) REFERENCES EMPLOYEE(Pnumber) ON DELETE SET DEFAULT ON UPDATE CASCADE); ON UPDATE CASCADE); CREATE TABLE DEPENDENT (Essn CHAR(9) NOT NULL, Dependent_name VARCHAR(15) NOT NULL, Sex CHAR, Bdate DATE, Relationship VARCHAR(8), PRIMARY KEY (Essn, Dependent_Name), FOREIGN KEY (Essn) REFERENCES EMPLOYEE(ssn) ON DELETE CASCADE ON UPDATE Suppose that each of the following update operations is applied independently to the database state given in CompanySchema.pdf. For each operation, write the name of all constraints if any. Also, write the reason for the violation. Write the new state of each table after each operation if the operation is not restricted. Show only the updated tables. a) Insert <'ProductA',4,'Bellaire',2> into PROJECT b) Insert <'Production',4,'943775543','1998-10-01'> into DEPARTMENT c) Insert <'677678989',NULL,'40.0'> into WORKS_ON d) Delete the PROJECT tuple with Pname%='ProductX' e) Delete the DEPARTMENT tuple with Dnumber=D4 f) Modify the Dnumber attribute of the DEPARTMENT tuple with Dnumber=4 to 2.
EMPLOYEE
Frame Minit Lname Sen Bdate Address Sex Salary Super sen Dno
+444
DEPARTMENT
Dname Dnumber
Mor an Mgr start date
DEPT LOCATIONS
Dnumber Dlocation
PROJECT
Prame Prumber Plocation Dnum
WORKS ON
Ennn Pno Hoir
Hours
DEPENDENT
Esen Dependent name Se Bdate Relationship
Reforential integrity constraints displayed
on the COMFWNY relational database
schema.
One possible database state for the COMPANY relational database schema.
EMPLOYEE
Fname Minit Lname
John
Frankin T
Sex Salary
30000 333445555 5
M 40000 Jo00665555
F 25000 Joe7e54321
43000 J88Ge5556
San
Bdate
Address
Super en Dno
123456789 1965-01-09 731 Fondren, Hounton, TX M
333445555 1955-12-08 638 Voas, Houston, TX
Go0087777 1960-01-19 3321 Castle, Spring. TX
987654321 1941-06-20 291 Berry, Bellaire, TX
Narayan 666884444 1962-09-15 975 Fire Oak, Humibile, TX M
B
Smith
Wong
Zelaya
Wallace
5
Alicia
4
Jennifer
F
38000 333445655
25000 333445555
M 25000 007654321
M 55000 NULL
Ramesh
English
453453453 1972-07-31 5631 Rice, Houston, TX
F
Joyce
Ahmad
A
987987907
1969-03-29 980 Dallan, Houston, TX
B80G05555 1937-11-10 450 Stone, Houston, TX
Jabbar
4
James
E
Borg
DEPARTMENT
DEPT LOCATIONS
Dnumber
Mar atart date
Dnumber
Dlocation
Dname
Mar en
Research
333445555
1988-06-22
Houston
Administration
987654321
1995-01-01
Stafford
Headquarters
1981-06-19
Belaire
Sugarland
Houston
WORKS ON
PROJECT
Essn
Pno
Hours
Prame
Pnumber
Plocation
Dnum
123456709
123456700
325
ProductX
Bellaire
ProductY
Productz
75
Sugartand
666884444
3
40.0
3
Houston
5
453453453
20.0
Computeriation
10
Stafford
4
453453450
20.0
Reorganization
20
Houston
333445565
10.0
4
Newbenefite
30
Stafford
333445566
3
10.0
333445565
333445555
10
10.0
DEPENDENT
20
100
Esan
Dependent na
Sex
Bdate
Relationshin
30
30.0
333445555
Alice
1986-04-05
Daughter
909887777
10
10.0
333445556
Theodore
M
1983-10-25
Son
987987087
10
35.0
333445555
1958-05-03
Spouse
Spouse
Joy
007007007
987654321
30
5.0
987654321
Abner
1942-02-28
30
20.0
123456700
Michael
1988-01-04
Son
987654321
20
15.0
123450700
Alice
1988-12-30
Daughter
B88665555
20
NULL
123456789
Ekrabeth
1967-05-05
Spoune
Transcribed Image Text:EMPLOYEE Frame Minit Lname Sen Bdate Address Sex Salary Super sen Dno +444 DEPARTMENT Dname Dnumber Mor an Mgr start date DEPT LOCATIONS Dnumber Dlocation PROJECT Prame Prumber Plocation Dnum WORKS ON Ennn Pno Hoir Hours DEPENDENT Esen Dependent name Se Bdate Relationship Reforential integrity constraints displayed on the COMFWNY relational database schema. One possible database state for the COMPANY relational database schema. EMPLOYEE Fname Minit Lname John Frankin T Sex Salary 30000 333445555 5 M 40000 Jo00665555 F 25000 Joe7e54321 43000 J88Ge5556 San Bdate Address Super en Dno 123456789 1965-01-09 731 Fondren, Hounton, TX M 333445555 1955-12-08 638 Voas, Houston, TX Go0087777 1960-01-19 3321 Castle, Spring. TX 987654321 1941-06-20 291 Berry, Bellaire, TX Narayan 666884444 1962-09-15 975 Fire Oak, Humibile, TX M B Smith Wong Zelaya Wallace 5 Alicia 4 Jennifer F 38000 333445655 25000 333445555 M 25000 007654321 M 55000 NULL Ramesh English 453453453 1972-07-31 5631 Rice, Houston, TX F Joyce Ahmad A 987987907 1969-03-29 980 Dallan, Houston, TX B80G05555 1937-11-10 450 Stone, Houston, TX Jabbar 4 James E Borg DEPARTMENT DEPT LOCATIONS Dnumber Mar atart date Dnumber Dlocation Dname Mar en Research 333445555 1988-06-22 Houston Administration 987654321 1995-01-01 Stafford Headquarters 1981-06-19 Belaire Sugarland Houston WORKS ON PROJECT Essn Pno Hours Prame Pnumber Plocation Dnum 123456709 123456700 325 ProductX Bellaire ProductY Productz 75 Sugartand 666884444 3 40.0 3 Houston 5 453453453 20.0 Computeriation 10 Stafford 4 453453450 20.0 Reorganization 20 Houston 333445565 10.0 4 Newbenefite 30 Stafford 333445566 3 10.0 333445565 333445555 10 10.0 DEPENDENT 20 100 Esan Dependent na Sex Bdate Relationshin 30 30.0 333445555 Alice 1986-04-05 Daughter 909887777 10 10.0 333445556 Theodore M 1983-10-25 Son 987987087 10 35.0 333445555 1958-05-03 Spouse Spouse Joy 007007007 987654321 30 5.0 987654321 Abner 1942-02-28 30 20.0 123456700 Michael 1988-01-04 Son 987654321 20 15.0 123450700 Alice 1988-12-30 Daughter B88665555 20 NULL 123456789 Ekrabeth 1967-05-05 Spoune
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 8 steps with 12 images

Blurred answer
Knowledge Booster
Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education