Question

Perform the following (each 3 Points): 1. List full details of all hotels. 2. List full details of all hotels in London 3. Li

need help MYSQL # 9 to 17 please

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

Answer:-------------
9.
SELECT COUNT(DISTINCT guestno)
FROM booking WHERE (datefrom <= 2004-04-01’ AND
dateto >= ‘2004-04-30’);
10.
SELECT price, type
FROM room, hotel
WHERE hotel.hotelno = room.hotelno AND hotelname = 'Grosvenor';

11.
SELECT * FROM guest
WHERE guestno IN (SELECT guestno FROM booking WHERE datefrom <= ‘SYSTEM DATE’
AND dateto >= ‘SYSTEM DATE’ AND hotelno = (SELECT hotelno FROM hotel WHERE hotelname = ‘Grosvenor’));   

12.
SELECT (r.hotelno, r.roomno, r.type, r.price)
FROM room r, hotel h
WHERE r.hotelno = h.hotelno AND
h.hotelname = 'Grosvenor’ AND
roomno NOT IN (SELECT roomno FROM booking b, hotel h WHERE (datefrom <= ‘SYSTEM DATE’ AND dateto >= ‘SYSTEM DATE’)
AND b.hotelno=h.hotelno AND hotelname = 'Grosvenor');
13.
SELECT r.* FROM room r LEFT JOIN
(SELECT g.guestname, h.hotelno, b.roomno FROM guest g, booking b, hotel h
WHERE g.guestno = b.guestno AND b.hotelno = h.hotelno AND h.hotelname= 'Grosvenor' AND
b.datefrom <= CURRENT_DATE AND b.dateto >= CURRENT_DATE) AS XXX
ON r.hotelno = XXX.hotelno AND r.roomno = XXX.roomno;

14.
SELECT hotelno, COUNT(roomno)
   FROM room
   GROUP BY hotelno;

15.
SELECT r.hotelno, COUNT(roomno)
   FROM room r, hotel h
   WHERE r.hotelno=h.hotelno AND city = 'London'
   GROUP BY r.hotelno;

16.
SELECT SUM(price)
FROM room r, hotel h
WHERE r.hotelno = h.hotelno AND h.hotelname = 'Grosvenor’ AND
roomno NOT IN (SELECT roomno FROM booking b, hotel h
WHERE (datefrom <= ‘SYSTEM DATE’ AND dateto >= ‘SYSTEM DATE’) AND
b.hotelno = h.hotelno AND r.hotelno=b.hotelno
AND r.roomno=b.roomno AND h.hotelname = 'Grosvenor');

17.
UPDATE room
   SET price = price*1.05;

Add a comment
Know the answer?
Add Answer to:
need help MYSQL # 9 to 17 please Perform the following (each 3 Points): 1. List...
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
  • 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....

  • HOW TO DO THIS DATABASE QUESTION USING ORACLE? Hotel (hotelNo, hotelName, hotelAddress, country) Room (roomNo, hotelNo,...

    HOW TO DO THIS DATABASE QUESTION USING ORACLE? Hotel (hotelNo, hotelName, hotelAddress, country) Room (roomNo, hotelNo, type, price) Guest (guestNo, guestName, guestAddress, country) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) (a).List all guests currently staying at the Grosvenor Hotel. Include the roomNo in the output. Use 2019-01-21 as the current date.            (b) What is the total income from bookings for the Grosvenor Hotel today? Do this question for each of the hotels with 'Grosvenor' in name. Use 2019-01-21 as the...

  • 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...

  • 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...

  • Language SQL Need help with SQL Question Create a view vHW1_8_xxxx listing the guest name, number...

    Language SQL Need help with SQL Question Create a view vHW1_8_xxxx listing the guest name, number of days and the amount each guest needs to pay to the hotels for their stays. Your result should not include any unknown value in the dateto. Your result should include guest name, hotel name, number of days, and amount to pay. Here is my code: select guestname, hotelname, datediff(dateto,datefrom), sum(datediff(dateto,datefrom)*price) from Guest g, Hotel h, Room r, Booking b where h.hotelno=b.hotelno and r.roomno=b.roomno...

  • making a file You are tasked with creating a text-based program for storing data on Hotel...

    making a file You are tasked with creating a text-based program for storing data on Hotel Room Bookings - however, as this is a comparative languages course, you will be creating the same application in the following three programming languages: • Java, • Python, and • Lisp As you implement the application in each language you should keep notes on: - The features of the languages used, - Which features you found useful, and - Any issues or complications which...

  • 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),...

  • Use SQL to slove the problem 1. (7) List all condos in building C, the date...

    Use SQL to slove the problem 1. (7) List all condos in building C, the date they were cleaned, and the full name of the staff who cleaned them in August. 2. (5) Display the activities reserved in June for more than 3 people. Include the activity description and label the output as Activities Reserved in June. 3. (4) Listing for all guides and their certification renewal dates for next year. Include full name and hire date. 4. (6) Management...

  • need help answering these with workout shown please 5-Star Lux Hotel Hotel Configuration Total Bed 1...

    need help answering these with workout shown please 5-Star Lux Hotel Hotel Configuration Total Bed 1 Bed 2 Bed 3 (Single) (Double) (Penthouse) 30 60 20 1 1 area per room (square metres) number of rooms first floor - 240 square metre second floor - 240 square metre third floor - 240 square metre number of rooms floor space square metres) planned occupancy rate (%) (open 365 days) average selling price (Stroom/night) 1 3 4 3 4 3 4 9...

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