Вы находитесь на странице: 1из 2

The following tables form part of a database held in a relational DBMS: Hotel (Hotel_No, Name, Address) Room (Room_No,

Hotel_No, Type, Price) Booking (Hotel_No, Guest_No, Date_From, Date_To, Room_No) Guest (Guest_No, Name, Address) where Hotel contains hotel details and Hotel_No is the primary key Room contains room details for each hotel and (Hotel_No, Room_No) forms the primary key. Booking contains details of the bookings and the primary key comprises (Hotel_No, Guest_No, Date From) and Guest contains guest details and Guest_No is the primary key. Write the SQL statements for the following: 1. List full details of all hotels in Mumbai. 2. List the names and addresses of all guests in New Delhi, alphabetically ordered by name. 3. List all double or family rooms with a price below Rs.800 per day, in ascending order of price. 4. List the bookings for which no date to has been specified. 5. What is the total daily revenue from all the double rooms? 6. How many different guests have made bookings for August, 2006? 7. List the price and type of all rooms at the hotel Land Mark. 8. What is the total income from bookings for the hotel Manor today?

Consider the following employee database schema: EMPLOYEE (ESSN, ENAME, DEPT_NO, SALARY) DEPENDENT (ESSN, DEPEND_NAME, RELATION, DOB) DEPARTMENT (DEPT_NO, DEPT_NAME, MANAGER) (a) Create the appropriate database using Oracle. (b) Perform following queries using SQL: (i) Find details of dependents for employee having name AJAY. (ii) Find the name of the manager of the department in which employee with ESSN Code 5078 works. (iii) Find the name of all employees whose age is less than 18 years. (iv) Find the DOB of the son of the employee having employee code ESSN 5078. (v) Find the details of the departments in which the employee having employee code ESSN 5078 has worked.

Вам также может понравиться