Question

Exercise I (50 pts): This exercise deals with a database that stores information about Hotel Management System. Customer (C e

Database

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

1. ER Diagram

Payadas method Country name C-emaf Did cbic Payment CUStoner Staius Inveice-1d generaie d TAVoie 7n Voice descripion las Date

2. Create database

CREATE DATABASE abc;

USE abc;

Create Customer and Invoice table

CREATE TABLE Customer( C_email varchar(200) PRIMARY KEY, name varchar(200), country varchar(200));

CREATE TABLE Invoice( Invoice_id varchar(200) PRIMARY KEY, status varchar(200), invoice_description varchar(200));

3. SQL Queries

a) SELECT c.name, r.category, re.date FROM

Customer c INNER JOIN Reservation re

ON c.C_email = re.C_email

INNER JOIN Hotel h

ON re.Hotel_id = h.Hote_id

INNER JOIN Rooms r

ON re.room_id = r.room_id;

b) SELECT c.name, count(p.Invoice_id) FROM

Customer c INNER JOIN Payment p

ON c.C_email = p.C_mail

GROUP BY c.name;

c) SELECT DISTINCT(name) FROM ( SELECT c.name FROM Customer c

WHERE c.country NOT IN ('Lebanon')

UNION

SELECT * FROM Customer c

WHERE c.C_email NOT IN ( SELECT re.C_email

FROM Reservation re)

);

d) SELECT b.reservation_id FROM Bill b

WHERE b.date <> '2019-09-09' AND b.amount < 1000.00;

Exercise II

1 - Invalid as we cannot subtract the values directly between two columns

2 - Invalid as we cannot subtract the values directly between two columns

3 - Invalid as we cannot perform SUM on title column; SUM works on numerals

4 - Valid, returns the average year of titles starting with C

5 - Valid, returns the count of each year

6 - Invalid, before grouping we cannot find the count. It has to be like group by year having count(*)>10.

Kindly Upvote if Helpful :)
HOPE THIS MAY HELP YOU----------------------

------------------------------THANK YOU---------------------------

Add a comment
Know the answer?
Add Answer to:
Database Exercise I (50 pts): This exercise deals with a database that stores information about Hotel...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

  • Star Inn is a chain of hotels. The reservation system is uses a centralized reservation database....

    Star Inn is a chain of hotels. The reservation system is uses a centralized reservation database. The database contains booking information on all hotels of Star Inn. The following is a description of the conceptual model of the hotel reservation database at Star Inn. The database contains information about hotels, hotel rooms, customers, and reservation. A hotel can be identified by its identification number (hotel_id). It is also described by hotel_name, address and phone_no. Rooms are identified by room_no which...

  • A computerised hotel reservation system is described below. The system shall treat customer requests as automatically as possible. A request is made over the Internet by either an existing customer or...

    A computerised hotel reservation system is described below. The system shall treat customer requests as automatically as possible. A request is made over the Internet by either an existing customer or a new prospect/customer. A customer is identified by his identity (eg name, address, email address or telephone number) and shall be captured by the system for him/her. His/her request is set in general terms: the requested hotel category, the number of people, budget, the number of rooms and the...

  • 2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query...

    2. SQL queries (40 points total, 5 points each query) Write SQL query statements to query the following Hotel Room Booking Database Tables. "cid" is Customer ID. "rid" is Room ID. "bid" is Booking ID. "dob" means Date of Vwwww Birth; "beds" means the number of beds in the room which is normally 1 or 2 beds. "DueDate" and "DueAmount" are the payment due dates and due amounts of this booking. Customers fname name phone email cid dob zipcode Rooms...

  • The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName,...

    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) where Hotel contains hotel details and hotelNo is the primary key; Room contains room details for each hotel and (roomNo, hoteINo) forms the primary key; Booking contains details of bookings and (hoteINo, guestNo, dateFrom) forms the primary key; Guest contains guest details and guestNo is the primary key....

  • I need help with this please, I'm very confused. Given the following relational model database schema:...

    I need help with this please, I'm very confused. Given the following relational model database schema: GUEST (email, address, phone_no, name) (phone_no) is a candidate key. Email and address are long strings, phone_no and name are also strings. TYPE (code, description) The type code is a numeric code and the description a length varying string. AMENITY (code, description) The amenity code is a numeric code and the description a length varying string. CITY (city_id, name, state, country) The city identification...

  • This is third time im posting this Question COURSE; introduction to database Please, No handwriti...

    This is third time im posting this Question COURSE; introduction to database Please, No handwriting thanks for your efforts Design the database by following . Execute the sample requested queries. . ER Diagram. . All schemas before and after normalization. . All SQL statements of: -Creating tables. - Inserting data in tables. -Queries. 5. Screenshots from MySQL (or any other software you use) Question is - Database system for a Wholesale Management System Consider a database system for a Wholesale...

  • This is third time im posting this Question COURSE; introduction to database Please, No handwriting thanks...

    This is third time im posting this Question COURSE; introduction to database Please, No handwriting thanks for your efforts Design the database by following . Execute the sample requested queries. . ER Diagram. . All schemas before and after normalization. . All SQL statements of: -Creating tables. - Inserting data in tables. -Queries. 5. Screenshots from MySQL (or any other software you use) Question is - Database system for a Wholesale Management System Consider a database system for a Wholesale...

  • Create the following SQL Server queries that access the Northwind database Same as problem 3 but,...

    Create the following SQL Server queries that access the Northwind database Same as problem 3 but, limit the list to all customers who placed 3 or more orders. The product id, product name, last date that the product was ordered for all items in the Grains/Cereals category. (Hint: Use MAX) The product ID, product name, and number of distinct customers who ordered that product in 1996 Thank you. Categories Customers Employees Order Details Orders Products Shippers 9 CategoryID CategoryName Description...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT