You are on page 1of 2

SEMESTER I 07/08

WXES2103 DATABASE
TUTORIAL 5 : SQL
1. Explain two components in SQL.
2. Study the following database schema :
Hotel (hotelNo, hotelName, city)
Room (roomNo, hotelNo, type, price)
Booking (hotelNo, guestNo, dateFrom, roomNo)
Guest ( guestNo, guestName, guestAddress)
Refer to the above schema to answer the following questions:
a)
b)
c)
d)
e)
f)
g)
h)

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 dateTo 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?

3. Using the table, answer all the question


EmployeeTable
EmpID EmpName

Salary

Address

State

DepartID

00001

Joe

1200

83 First Street

Ohio

02

01002

Mary

870

842 Vine Ave.

Ohio

01

00200

Sam

1750

33 Elm St.

New York

01

010210

Sarah

1050

440 U.S. 110

Michigan

03

DepartmentTable
DepartID DepartName
01

Management

02

Accounting

03

Marketing

a. Show all the details of employee


b. Show employees name who live in OHIO
c. Count the total of employee from department management, named it as
MANAGEMENT
d. Get the average of the employees salary
e. Delete employee with EmpID is 010210

You might also like