Answer the following: Consider a scenario where we are required to update a table that already contains data, e.g., adding a new attribute Is it better to regenerate the table or just update it? Consider the situation when the table has not 20, but 20 million records. What are the pros and cons of updating the table vs. re-creating it from scratch? What could you do if you were not allowed to re-create a table from scratch, i.e., you can only modify it? CREATE TABLE HOTEL ( hotelNo INT NOT NULL, hotelName VARCHAR(50), City VARCHAR(50), primary key (hotelNo) ); CREATE TABLE ROOM ( roomNo INT NOT NULL, H_hotelNo INT NOT NULL, roomType CHAR(10), price decimal(5,2), primary key (roomNo, H_hotelNo), foreign key (H_hotelNo) REFERENCES HOTEL(hotelNo), CHECK (price >= 50.00), CHECK (price <= 500.00), CHECK (roomType = 'Single' OR roomType = 'Double' OR roomType = 'Standard'), CHECK (RoomNo >= 1), CHECK (RoomNo <= 9999) ); CREATE TABLE BOOKING ( H_hotelNo INT NOT NULL, G_guestNo INT NOT NULL, dateFrom DATE NOT NULL, dateTo DATE, R_roomNo INT NOT NULL, primary key (H_hotelNo, G_guestNo, dateFrom, R_roomNo), foreign key (H_hotelNo) REFERENCES HOTEL(hotelNo), foreign key (G_guestNo) REFERENCES GUEST(guestNo), foreign key (R_roomNo) REFERENCES ROOM(roomNo), CHECK (dateFrom < dateTo) ); CREATE TABLE GUEST ( guestNo INT NOT NULL, guestName CHAR(100), guestAddress VARCHAR(100), primary key (guestNo), unique (guestName) );

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

Answer the following: Consider a scenario where we are required to update a table that already contains data, e.g., adding a new attribute Is it better to regenerate the table or just update it? Consider the situation when the table has not 20, but 20 million records. What are the pros and cons of updating the table vs. re-creating it from scratch? What could you do if you were not allowed to re-create a table from scratch, i.e., you can only modify it?

CREATE TABLE HOTEL
(
hotelNo INT NOT NULL,
hotelName VARCHAR(50),
City VARCHAR(50),
primary key (hotelNo)
);
CREATE TABLE ROOM
(
roomNo INT NOT NULL,
H_hotelNo INT NOT NULL,
roomType CHAR(10),
price decimal(5,2),
primary key (roomNo, H_hotelNo),
foreign key (H_hotelNo) REFERENCES HOTEL(hotelNo),
CHECK (price >= 50.00),
CHECK (price <= 500.00),
CHECK (roomType = 'Single' OR roomType = 'Double' OR roomType = 'Standard'),
CHECK (RoomNo >= 1),
CHECK (RoomNo <= 9999)
);
CREATE TABLE BOOKING
(
H_hotelNo INT NOT NULL,
G_guestNo INT NOT NULL,
dateFrom DATE NOT NULL,
dateTo DATE,
R_roomNo INT NOT NULL,
primary key (H_hotelNo, G_guestNo, dateFrom, R_roomNo),
foreign key (H_hotelNo) REFERENCES HOTEL(hotelNo),
foreign key (G_guestNo) REFERENCES GUEST(guestNo),
foreign key (R_roomNo) REFERENCES ROOM(roomNo),
CHECK (dateFrom < dateTo)
);
CREATE TABLE GUEST
(
guestNo INT NOT NULL,
guestName CHAR(100),
guestAddress VARCHAR(100),
primary key (guestNo),
unique (guestName)
);

2. Answer the following: Consider a scenario where we are required to
update a table that already contains data, e.g., adding a new attribute
a. Is it better to regenerate the table or just update it? Consider the
situation when the table has not 20, but 20 million records.
b.
What are the pros and cons of updating the table vs. re-creating it from
scratch?
c.
What could you do if you were not allowed to re-create a table from
scratch, i.e., you can only modify it?
Transcribed Image Text:2. Answer the following: Consider a scenario where we are required to update a table that already contains data, e.g., adding a new attribute a. Is it better to regenerate the table or just update it? Consider the situation when the table has not 20, but 20 million records. b. What are the pros and cons of updating the table vs. re-creating it from scratch? c. What could you do if you were not allowed to re-create a table from scratch, i.e., you can only modify it?
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
SQL Query
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