Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
The following tables form part of a database held in a relational DBMS:
Hotel (hotelNo, hotelName, city)
Room (roomNo, hotelNo, type, price)
Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo)
Guest (guestNo, guestName, guestAddress)
• 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 (hotelNo, guestNo, dateFrom) forms the
primary key;
• Guest contains guest details and guestNo is the primary key.
Download and install PostgreSQL (Version 14.5). Create the tables for the four rela-
tions using the integrity enhancement features of SQL (using the “CREATE TABLE” state-
ments) and populate at least 5 tuples for each relation (using the “INSERT” statements)
in PostgreSQL. Please report the screenshots of these SQL statements generated from
PostgreSQL.
Run the SQL statements for the following queries and report the screenshots
of these SQL statements and the results generated from PostgreSQL.
(a) List the roomNo, type, and price of the Biltmore Hotel (using subquery) (or a specific
hotel name in your database).
(b) What is the average price of a room?
(c) List the guestNo and gusetName of guests who live in Chicago or Seattle, alphabetically
ordered by their names.
(d) List the number of rooms in each hotel in Kansas City.
(e) List full details of every room in Room relation.
(f) Update the price of all rooms by 8% and then list full details of every room in Room
relation. Compare the output with the output in (e).
Hotel (hotelNo, hotelName, city)
Room (roomNo, hotelNo, type, price)
Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo)
Guest (guestNo, guestName, guestAddress)
• 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 (hotelNo, guestNo, dateFrom) forms the
primary key;
• Guest contains guest details and guestNo is the primary key.
Download and install PostgreSQL (Version 14.5). Create the tables for the four rela-
tions using the integrity enhancement features of SQL (using the “CREATE TABLE” state-
ments) and populate at least 5 tuples for each relation (using the “INSERT” statements)
in PostgreSQL. Please report the screenshots of these SQL statements generated from
PostgreSQL.
Run the SQL statements for the following queries and report the screenshots
of these SQL statements and the results generated from PostgreSQL.
(a) List the roomNo, type, and price of the Biltmore Hotel (using subquery) (or a specific
hotel name in your database).
(b) What is the average price of a room?
(c) List the guestNo and gusetName of guests who live in Chicago or Seattle, alphabetically
ordered by their names.
(d) List the number of rooms in each hotel in Kansas City.
(e) List full details of every room in Room relation.
(f) Update the price of all rooms by 8% and then list full details of every room in Room
relation. Compare the output with the output in (e).
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
it says relation hotel already exist
Solution
by Bartleby Expert
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
it says relation hotel already exist
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- StayWell also rents out properties on a weekly basis to students attending summer school in the Seattle area. Design a database to meet the following requirements, using the shorthand representation and a diagram of your choice. For each student renter, list his or her number, first name, middle initial, last name, address, city, state, postal code, telephone number, and e-mail address. For each property, list the office number, property address, city, state, postal code, square footage, number of bedrooms, number of floors, maximum number of persons that can sleep in the unit, and the base weekly rate. For each rental agreement, list the renter number, first name, middle initial, last name, address, city, state, postal code, telephone number, start date of the rental, end date of the rental, and the weekly rental amount. The rental period is one or more weeks.arrow_forwardEMPLOYEE Frame Minit Lname Sen Bdate Address Sex Salary Super sen Dno +444 DEPARTMENT Dname Dnumber Mor an Mgr start date DEPT LOCATIONS Dnumber Dlocation PROJECT Prame Prumber Plocation Dnum WORKS ON Ennn Pno Hoir Hours DEPENDENT Esen Dependent name Se Bdate Relationship Reforential integrity constraints displayed on the COMFWNY relational database schema. One possible database state for the COMPANY relational database schema. EMPLOYEE Fname Minit Lname John Frankin T Sex Salary 30000 333445555 5 M 40000 Jo00665555 F 25000 Joe7e54321 43000 J88Ge5556 San Bdate Address Super en Dno 123456789 1965-01-09 731 Fondren, Hounton, TX M 333445555 1955-12-08 638 Voas, Houston, TX Go0087777 1960-01-19 3321 Castle, Spring. TX 987654321 1941-06-20 291 Berry, Bellaire, TX Narayan 666884444 1962-09-15 975 Fire Oak, Humibile, TX M B Smith Wong Zelaya Wallace 5 Alicia 4 Jennifer F 38000 333445655 25000 333445555 M 25000 007654321 M 55000 NULL Ramesh English 453453453 1972-07-31 5631 Rice, Houston, TX F…arrow_forwardPrepare a MySQL script that creates your database, tables, and inserts a small sampling of madeupdata. Test it out in MySQL before submission For the below diagram write the SQL queriesarrow_forward
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education