Question

I need help with this please, I'm very confused. Given the following relational model database schema:...

I need help with this please, I'm very confused.

Given the following relational model database schema:


GUEST (email, address, phone_no, name) (phone_no) is a candidate key.

Email and address are long strings, phone_no and name are also strings.

TYPE (code, description)
The type code is a numeric code and the description a length varying string.

AMENITY (code, description)
The amenity code is a numeric code and the description a length varying string.

CITY (city_id, name, state, country)
The city identification is a four-character alphanumeric string. Name and country are required strings while state if present is a four-character string.

HOTEL (hotel_name, check_in_time, check_out_time, city) (city) FK CITY Hotel names are up to 512 characters. Check in and check out times are time values.

HOTEL_PHONES (hotel_name, phone) (hotel_name) FK HOTEL The hotel phone are strings long enough to represent an international phone number.

ROOM (hotel_name, room_number, floor, room_type) (hotel_name) FK HOTEL

Room numbers are integer values as well as the floor number.

(room_type) FK TYPE

HOTEL_AMENITIES (hotel_name, amenity_code) (hotel_name) FK HOTEL (amenity_code) FK AMENITY

STAY (email, hotel_name, room_number, start_date, ccard_type, ccard_number, total_amount) (email) FK GUEST

(hotel_name, room_number) FK ROOM

Start date is a date without time. The credit card type is a five-character string and the number a 16-character string (fixed length). The total amount represents the total paid by the guest in the stay, represented by a numeric format that allow any value from $0.00 to $99,999.99.

Questions

  1. 1) Write the DDL statements to create the relations in a DBMS. For datatypes follow the ones available for MySQL server v5.7. See reference link below. [30 marks]

  2. 2) Write the insert statements to add 3 guests, 1 hotel with 3 rooms and one stay for each guest in the available hotel. [10 marks]

  3. 3) Write the SQL statement(s) to delete the guest with email [email protected]. [5 marks]

  4. 4) Write an update statement to increase by 10% all the stays with start date between

    January 1st, 2018 and July 1st, 2019. [5 marks]

  5. 5) Answer the following queries using SQL:

    1. List all hotels in Denver, CO, USA. [5 marks]

    2. List the phone numbers for hotels in Roma, Italy. [5 marks]

    3. List hotel name, room number and type description for all hotels. [5 marks]

    4. List hotel name, check in time and amenities description for all hotels. [5 marks]

    5. List the names and city name for hotels that have at least one room with type “Double Suite Room”. [10 marks]

    6. List the guest names, stay date, for guests that stayed in hotels in New York, NY, USA. [10 marks]

    7. List the guest names, stay date and paid amount, for guests that stayed in hotels in New York, NY, USA or San Francisco, CA, USA during July 2018. [10 marks]

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.

CREATE TABLE GUEST
(email VARCHAR[20] NOT NULL,
address VARCHAR[50],
phone_no VARCHAR[15],
name VARCHAR[20]
);

2.

CREATE TABLE TYPE
(
code VARCHAR[20],
description VARCHAR[100]
);

3,

CREATE TABLE AMENITY
(
code VARCHAR[20],
description VARCHAR[100]
);

4.

CREATE TABLE CITY
(
city_ID INT,
name VARCHAR[20],
country VARCHAR[20]
);
5.

CREATE TABLE HOTEL
(

hotelname VARCHAR[20],
check_in_time TIME,
check_out_time TIME,
city VARCHAR[20]
);

6.

CREATE TABLE HOTEL
(
hotel_name VARCHAR[20],
phone VARCHAR[20]
);

7.

CREATE TABLE ROOM
(
hotel_name VARCHAR[20],
room_no INT,
floor INT,
room_type VARCHAR[20]
);

8.

CREATE TABLE HOTEL_AMENITIES
(
hotel_name VARCHAR[20],
amenitycode INT
);

9.

CREATE TABLE STAY
(
email VARCHAR[20],
  hotel_name VARCHAR[20],
room_no INT,
start_date DATE,
ccard_type VARCHAR(5),
ccard_no VARCHAR(16),
totol_amt FLOAT

);

10.

CREATE TABLE FK_GUST
(
  hotel_name VARCHAR[20],
room_no INT
);

2

INSERT INTO GUEST VALUES('[email protected]','new york',7578341087,'guest1');

3   

DELETE FROM GUEST WHERE email='[email protected]';
  

Add a comment
Know the answer?
Add Answer to:
I need help with this please, I'm very confused. Given the following relational model database schema:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • need help MYSQL # 9 to 17 please Perform the following (each 3 Points): 1. List...

    need help MYSQL # 9 to 17 please Perform the following (each 3 Points): 1. List full details of all hotels. 2. List full details of all hotels in London 3. List the names and addresses of all guests in London, alphabetically ordered by name. 4. List all double or family rooms with a price below $40 per night, in ascending order of price. 5. List the bookings for which no dateTo has been specified. 6. How many hotels are...

  • The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName,...

    The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) where Hotel contains hotel details and hotelNo is the primary key; Room contains room details for each hotel and (roomNo, hoteINo) forms the primary key; Booking contains details of bookings and (hoteINo, guestNo, dateFrom) forms the primary key; Guest contains guest details and guestNo is the primary key....

  • 2. The following tables form part of a database hield in a relatioual DBMS: (10 Points)...

    2. The following tables form part of a database hield in a relatioual DBMS: (10 Points) Hotel Room Booking Guest hotelNo, hotelName, city {room No. hotelNo. Type.price) booking No, hotelNo, guestNo, date from date To roomNo) (guestNo. guestName. guestAddress) A. List the price and type of all rooms at the Shangri-La Hotel B. Listall guests staying at Shangri-La Hotel berween Jimmy I and January 31, 2020 Liste details of all rooms at the Shangri-La llore, including the name of the...

  • Database Exercise I (50 pts): This exercise deals with a database that stores information about Hotel...

    Database Exercise I (50 pts): This exercise deals with a database that stores information about Hotel Management System. Customer (C email, name, country) Payment (Invoice id, C email, payment method, date) invoice (Invoice id, starus, invoice description) Has (Bill id. Invoice id) 9a Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id, room id, C email, date, period, reservation id) Rooms(Hotel id. room id, price, category) Hotel (Hotel id. H name. country) Own (room id,...

  • Hello, I need help answering all 8 of these questions for my BIS 422 class. I...

    Hello, I need help answering all 8 of these questions for my BIS 422 class. I need the appropriate MySQL script to use for these questions Provide the SQL for the following data requests. Your SQL should be written as a single script that can be pasted into MySQL and run without edits. Make sure you use the proper notation for your comments (see the practice solution for an example of the format). There will be a 5% deduction for...

  • Write Ten SQL SELECT statements to query the STUDENT schema you created for practice lab. 4....

    Write Ten SQL SELECT statements to query the STUDENT schema you created for practice lab. 4. List all cities that have 10 or more students and instructors combined. Show city, state, number of student residents, number of instructor residents, and total student/instructor residents in that city. Sort by total in descending order. 5. List the instructor id and name of the instructors that teach fewer than 10 sections. 7. Find how many students are enrolled in sections taught by Todd...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

  • the first question java code eclipse app the second question is java fx gui caculator please...

    the first question java code eclipse app the second question is java fx gui caculator please fast 1. Create project called "YourFirstName_QUID'. Eg. Aliomar_202002345 2. Create two package Q1 and Q2. 3. Add your name and studentID as comments on the top of each Java source file you submit. Question 1. Bookings APP [80 Points-six parts] Implement the following hotel booking system. Use the following class diagram to understand the structure of the system's classes, their attributes operations (or methods),...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT