English

Pranav is managing a Travel Database and needs to access certain information from the Hotels and Bookings tables for an upcoming tourism survey. - Computer Science (Python)

Advertisements
Advertisements

Question

Pranav is managing a Travel Database and needs to access certain information from the Hotels and Bookings tables for an upcoming tourism survey. Help him extract the required information by writing the appropriate SQL queries as per the tasks mentioned below: 

  1. To display a list of customer names who have bookings in any hotel of 'Delhi' city.
  2. To display the booking details for customers who have booked hotels in 'Mumbai', 'Chennai', or 'Kolkata'.
  3. To delete all bookings where the check-in date is before 2024-12-03.
  4. A. To display the Cartesian Product of the two tables.
                                         OR
    B. To display the customer’s name along with their booked hotel’s name.
Code Writing
Advertisements

Solution

  1. SELECT Customer_Name FROM Hotels, Bookings WHERE Hotels.H_ID =
    Bookings.H_ID AND City = 'Delhi';
  2. SELECT Bookings.* FROM Hotels, Bookings WHERE Hotels.H_ID =
    Bookings.H_ID AND City IN ('Mumbai', 'Chennai', 'Kolkata');
  3. DELETE FROM Bookings WHERE Check_In <'2024-12-03';
  4. A.

    SELECT * FROM Hotels, Bookings;

                                              OR
    B. 

    SELECT Customer_Name, Hotel_Name FROM Hotels, Bookings
    WHERE Hotels.H_ID = Bookings.H_ID;
shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×