Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DDL in MySQL Workbench, I need a screenshot for the output (record table and so on) of the following DDL code: (( if the code

DDL in MySQL Workbench, I need a screenshot for the output (record table and so on) of the following DDL code:

(( if the code needs to edit or there is something wrong you can edit and tell me about it))

<><><><><><><><><><>

Create Database hotels;

USE hotels;

create table hotel(

hotelNo int primary key,

hotelName varchar(45) not null,

city varchar(45) not null

);

create table room(

roomNo int primary key ,

roomType varchar(45) not null,

price decimal(10,0) not null,

hotelNo int(11),

foreign key (hotelNo) references Hotel (hotelNo) ON DELETE CASCADE ON

UPDATE CASCADE

);

create table Guest(

guestNo int(11) primary key ,

guestName varchar(45) not null ,

guestAddress text

);

create table Booking(

guestNo int ,

dateFrom date ,

dateTo date ,

primary key (guestNo,dateFrom,dateTo),

hotelNo int(11) not null,

roomNo int(11) not null,

foreign key (guestNo) references guest (guestNo) ON DELETE CASCADE ON

UPDATE CASCADE,

foreign key (hotelNo) references hotel (hotelNo) ON DELETE CASCADE ON

UPDATE CASCADE,

foreign key (roomNo) references room (roomNo) ON DELETE CASCADE ON

UPDATE CASCADE

);

alter table guest

add column gender char(1)

null check (gender='F' or gender='M');

alter table room

alter column roomType set default "single";

alter table booking

add foreign key(roomNo) references room(roomNo) ON DELETE CASCADE ON

UPDATE CASCADE ;

alter table room

drop column price ;

<><><>

SELECT * FROM hotels.hotel;

INSERT INTO hotel VALUES (1,"Ritz Carlton","riyadah");

INSERT INTO hotel VALUES (2,"hayyat","Khobar");

INSERT INTO hotel VALUES (3,"The Luxury Collection Hotels & Resorts","Riyadh");

INSERT INTO hotel VALUES (4,"Marriott","Khobar");

INSERT INTO hotel VALUES (5,"Rosewood Hotels & Resorts","Dammam");

INSERT INTO hotel VALUES (6,"Blue Moon Hotel","Madinah");

INSERT INTO hotel VALUES (7,"Four Seasons","Jaddah");

INSERT INTO hotel VALUES (8,"Ace Hotel","Makkah");

<><>

SELECT * FROM hotels.room;

INSERT INTO room VALUES(1001,"king",1);

INSERT INTO room VALUES(201,default,3);

INSERT INTO room VALUES(903,"master",5);

INSERT INTO room VALUES(719,"Master",7);

INSERT INTO room VALUES(215,default,2);

INSERT INTO room VALUES(516,"queen",4);

INSERT INTO room VALUES(102,default,6);

INSERT INTO room VALUES(204,default,8);

<><>

SELECT * FROM hotels.guest;

INSERT INTO guest VALUES(1,"saleh","dammam","M");

INSERT INTO guest VALUES(2,"Roqayah","Qatif","F");

INSERT INTO guest VALUES(3,"hind","dahran","F");

INSERT INTO guest VALUES(4,"fares","khobar","M");

INSERT INTO guest VALUES(5,"yousef","khobar","M");

INSERT INTO guest VALUES(6,"Amal","Madina","F");

INSERT INTO guest VALUES(7,"farah","Jaddah","F");

INSERT INTO guest VALUES(8,"turki","jubail","M");

<><>

SELECT * FROM hotels.booking;

INSERT INTO booking VALUES(1,"2021-03-04","2021-03-19",1,1001);

INSERT INTO booking VALUES(2,"2021-05-26","2021-07-01",2,201);

INSERT INTO booking VALUES(3,"2021-01-21","2021-12-10",3,903);

INSERT INTO booking VALUES(4,"2021-09-21","2021-09-28",4,516);

INSERT INTO booking VALUES(5,"2021-04-13","2021-05-11",5,102);

INSERT INTO booking VALUES(6,"2021-08-22","2021-09-24",6,204);

INSERT INTO booking VALUES(7,"2021-03-02","2021-03-09",7,215);

INSERT INTO booking VALUES(8,"2021-06-02","2021-06-10",8,719);

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is cost plus pricing ?

Answered: 1 week ago

Question

1. What are the types of wastes that reach water bodies ?

Answered: 1 week ago

Question

Which type of soil has more ability to absorb water?

Answered: 1 week ago

Question

1. Write down two or three of your greatest strengths.

Answered: 1 week ago