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) );
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?](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2e36c7fa-9d7b-4c50-95c2-65f9c58ec0be%2Fb8832c11-9a08-49af-8c72-3b29c2d2c6bd%2Fujtax1n_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)