Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following relational model represents a hotel's relational database schema. guest (gid: int, gname: varchar, age: int, city: varchar) soom (rnum: int, rtype: varchar, floor:

image text in transcribed

image text in transcribed

The following relational model represents a hotel's relational database schema. guest (gid: int, gname: varchar, age: int, city: varchar) soom (rnum: int, rtype: varchar, floor: int) booking (gid:int, rnum:int, day: date) The attributes of relations and constraints are explained as follows: gid: the unique ID of a guest. gname: the name of a guest. gname cannot be null. age: the age of a guest city: the city a guest lives in rnum: the unique number of a room rtype: the type of a room (double, queen, or king). rytpe cannot be null. floor: the floor where a room is located on floor cannot be null. day: the date on which a specific room is booked by a specific guest. The three relations are created with required database constraints as shown below: CREATE TABLE guest ( gid INTEGER, gname VARCHAR(40) NOT NULL, age INTEGER, city VARCHAR(40), PRIMARY KEY (gid) Di CREATE TABLE room rnum INTEGER, rtype VARCHAR(40) NOT NULL, floor INTEGER NOT NULL, PRIMARY KEY (rnum) ); CREATE TABLE booking gid INTEGER, rnum INTEGER, day DATE, PRIMARY KEY (gid, rnum, day), FOREIGN KEY (gid) REFERENCES guest(gid) on delete no action on update cascade, FOREIGN KEY (rnum) REFERENCES room(rnum) on delete no action on update cascade ); For each question (1) (5), provide your answer based on the instance of the DB as shown below. Note that each question is independent. guest room booking 1 Silvia Noel 51 Seattle 2 Lacota Frederick 24 Spokane 3 Zach Perez 33 Vancouver 4 Gabriel Bent 55 San Antonio 5 Clarke Clement 69 San Francisco 6 Quin Whitley 47 New York 7 Austin Lee 66 Eau Claire 8 Portia Garrett 61 Chicago 9 Matt Buck 39 Traverse City 10 Hwang Lui 44 Denver 1 2 3 4 5 6 double 1 double 1 king 2 queen 3 queen 3 queen 3 1 1 1 2 2 1 2 2 3 6 4 2 5 5 6 3 6 4 6 5 6 6 2018-05-07 2019-02-23 2019-04-10 2019-04-10 2020-03-22 2020-03-28 2020-01-20 2020-05-10 2020-05-10 2020-05-10 2020-06-15 a o o o on For each question, (1) provide your answer to whether or not the given SQL commands are executed or not (either success or fail) (2) if the execution is failed, explain why the request is denied, and if it is succeeded without errors, list ALL the changes in the DB tables after the SQL execution. You must mention ALL tables where changes are occurred. Again, each of the questions is independent. (1) If we execute the following command: DROP TABLE room; (2) If we execute the following command: INSERT INTO booking VALUES(5, 4, 2021-06-30"); (3) If we execute the following command: INSERT INTO booking VALUES (1, 10, 2020-07-30'); (4) If we execute the following command: DELETE FROM guest WHERE gid = 10; (5) If we execute the following command: UPDATE SET WHERE room rnum = 11 rnum = 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

LO2 Distinguish among three types of performance information.

Answered: 1 week ago