Question: 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:

 The following relational model represents a hotel's relational database schema. guest

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 )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!