Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me with these questions? I am using SQL plus. This is database relations shema. Hotel (hotelNo, hotelName, hotelAddress, country) Room (roomNo, hotelNo,

Can someone help me with these questions?

I am using SQL plus.

This is database relations shema.

Hotel (hotelNo, hotelName, hotelAddress, country)

Room (roomNo, hotelNo, type, price)

Guest (guestNo, guestName, guestAddress, country)

Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo)

I created tables.

CREATE TABLE Hotel (hotelNo NUMBER(4) NOT NULL ,hotelName VARCHAR2(16) NOT NULL ,hotelAddress VARCHAR2(40) NOT NULL ,country VARCHAR2(20) NOT NULL ,PRIMARY KEY (hotelNo) );

CREATE TABLE Room (hotelNo NUMBER(4) NOT NULL ,roomNo NUMBER(4) NOT NULL ,type VARCHAR2(8) NOT NULL ,price NUMBER(6,2) NOT NULL ,PRIMARY KEY (hotelNo, roomNo) );

CREATE TABLE Guest (guestNo NUMBER(4) NOT NULL ,guestName VARCHAR2(15) NOT NULL ,guestAddress VARCHAR2(40) NOT NULL ,country VARCHAR2(20) NOT NULL ,PRIMARY KEY (guestNo) );

CREATE TABLE Booking (hotelNo NUMBER(4) NOT NULL ,guestNo NUMBER(4) NOT NULL ,dateFrom DATE NOT NULL ,dateTo DATE ,roomNo NUMBER(4) NOT NULL ,PRIMARY KEY (hotelNo, guestNo, dateFrom) );

-Use only a single query statement to solve each query question.

-Do NOT use subqueries for this

By the way, you don't have to calculate anything for these questions since you don't have data.

I couldn't able to post data because it was too long.

Please just provide me codes about how to do it.

Here is the question.

What is the percentage of hotels still under construction? List the total number of hotels, number of hotels completed, the number of hotels under construction, and the percentage of hotels under construction. (Note: NO SUBQUERY; use OUTER JOIN with aggregates.)

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago