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

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

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

Thông tin tài liệu

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. (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 ? . 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. 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

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

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan