Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use your knowledge of DDL in MxSal Workbench to answer the following: (answers should be working SQL statements) 1- Create a new database named hotels.
Use your knowledge of DDL in MxSal Workbench to answer the following: (answers should be working SQL statements) 1- Create a new database named hotels. 2- Create the tables Hotel, Room, Booking and Guest with the following columns. Declare the corresponding primary and foreign keys: corresponding rows are deleted (or updated) from the referencing table if that row is deleted (or updated) from the parent table. a. Hotel Table: Table: hotel Columns hotelNo int(11) PK hotelName varchar(45) city varchar(45) b. Room Table: Table: room Columns: roomNo int(11) PK hotelNo int(11) PK type varchar(45) price decimal(10,0) c. Guest Table: Table: guest Columns: questNo int(11) PK guestName varchar(45) guestAddress text d. Booking Table: Table: booking Columns: hotelNo int(11) questNo int(11) PK dateFrom date PK date To date PK roomNo int(11) swer: 3- Add a referential integrity constraint (FK constraints) on the attribute 'room No' from booking table to refer to the attribute 'roomNo' in room table. 4- Add a new column to the guest table to represent the guest's gender. Name the column gender' of type char(1). 5- Add a constraint to column 'gender' in the guest table to limit the possible values to F or M. (note: CHECK might not work with MySQL Workbench, can you think of a way to make it work?) 6- Modify the column 'type' in the room table to have a default value of single. 7- Delete the column 'price' from the room table. 8- Populate your tables with 8 records at least in every table. Include the INSERT statements and screenshots of the final tables after insertions
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started