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) );

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter13: Views
Section: Chapter Questions
Problem 18MC
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage