1. Trang chủ
  2. » Công Nghệ Thông Tin

bài tập trắc nghiệm cơ sở dữ liệu chương 5 sql tutorial

2 580 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 24 KB

Nội dung

Hotel hotelNo, name, address Room roomNo, hotelNo, type, price Booking hotelNo, guestNo, dateFrom, dateTo, roomNo Guest guestNo, name, address where Hotel contains hotel details and hote

Trang 1

Chapter 5 - SQL

Tutorial

1 What are the two major components of SQL and what function do they serve ?

2 What are the advantages and disadvantages of SQL ?

3 The following tables form part of a database held in a relational DBMS

Hotel (hotelNo, name, address)

Room (roomNo, hotelNo, type, price)

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

Guest (guestNo, name, address)

where

Hotel contains hotel details and hotelNo is the primary key

Room contains room details for each hotel and roomNo, hotelNo forms the primary

key

Booking contains details of the bookings and the primary key comprises hotelNo,

guestNo and dateFrom

Guest contains guest details and guestNo is the primary key

(a) Construct an SQL statement to answer the following queries

(i) List full details of all hotels

(ii) List full details of all hotels in London

(iii) List the names and addresses of all guests in London, alphabetically

ordered by name

(iv) List all double or family rooms with a price below 40.00 per night,

in ascending order of price.

(v) List the bookings for which no date_to has been specified

Trang 2

(vi) How many hotels are there ?

(vii) What is the average price of a room ?

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

(viv) List the price and type of all rooms at the Grosvenor Hotel

(x) List all guests currently staying at the Grosvenor Hotel

(xi) What is the total income from bookings for the Grosvenor Hotel

today ?

(xii) List the number of rooms in each hotel

(xiii) List the number of rooms in each hotel with more than 100 rooms

and located in London

(xiv) What is the most commonly booked room type for each hotel in

London ?

Ngày đăng: 22/10/2014, 10:45

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w