Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQL Exercises: please provide the correct SQL statements according these below requistie: The following tables form part of a database held in a relational DBMS.

SQL Exercises: please provide the correct SQL statements according these below requistie:

The following tables form part of a database held in a relational DBMS. (5+20x2)

Hotel (hotelNo char(4), name varchar2(20), address varchar2(20), city varchar2(12))

Room (roomNo char(4), hotelNo char(4), type varchar2(10), price number(7,2))

Booking (bookingID number, hotelNo char(4), guestNo char(4), dateFrom date, dateTo date, roomNo char(4))

Guest (guestNo char(4), name varchar2(20), address varchar2(25), city varchar2(12))

Hotel contains hotel details and hotelNo is the primary key. Room contains room details for each hotel and roomNo, hotelNo may be unique. Booking contains details of the bookings and the primary key is generated using sequence. Guest contains guest details and guestNo is the primary key.

Use the given .SQL file to create tables and insert data partially. You need to add more reservations to run the following queries:

Construct an SQL statement to answer the following queries.

List full details of all hotels.

List full details of all hotels in London.

List the names and addresses of all guests in London, alphabetically ordered by name.

List all double or family rooms with a price below 40.00 per night, in ascending order of price.

List the bookings for which no date_to has been specified.

How many hotels are there?

What is the average price of a room?

What is the total revenue per night from all double rooms?

List the price and type of all rooms at the Grosvenor Hotel.

List all guests currently staying at the Grosvenor Hotel.

What is the total income from bookings for the Grosvenor Hotel today? (today is in between fromDate and toDate)

List the number of rooms in each hotel.

List the number of rooms in each hotel with more than 100 rooms and located in London.

List the guests that never had any bookings

List the customer who books the most expensive room

List the highest booked room with the count of times it was booked for

List all the room details hotelwise

Make a report of all bookings as :

Date Hotel number Room number From To Number of Nights stayed

List all the bookings for the hotel with the highest price

List the todays booking with the name of the guest staying in the hotel

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

Step: 3

blur-text-image

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions