Return to Assignments
Questions based on Car Rental Database
Write SELECT statements for each of the following:
- Retrieve all customers who currently have car rental bookings. Display their customer number, name and address together with the rental start date.
- Retrieve all customers who have booked a car in-group 'A1' and display the customer number, model, registration, rate per day, rate per mile and date reserved.
- Retrieve the registration, group, model, rate per day, date reserved, date rental start, customer number, customer name and address for all customer bookings taken since February 1 1992.
- Retrieve model, registration, rate per day from the cars table, for those cars whose daily rate is less than the daily rate for model 'P924'.
Write SELECT statements, which incorporate a subquery for each of the following:
- Select customer number, name, town, from the customers table for customers who have had their bookings taken by ' JAB'.
- Retrieve model, registration, rental start date, customer number and town for all bookings made by customer who live in London, Bristol or Birmingham.
- Write a SELECT statement to find the car, which has the cheapest daily rate.
- Write a SELECT statement to return the number of car groups in the cars table. Do not include duplicates.
- Write a SELECT statement to return the total number of customers who have rented during 1989. Use the HAVING clause to exclude those customers who did not charge the rental to their account.
- Write a SELECT statement, which returns just the models, groups and maintenance intervals of the cars in the cars table. The rows should be returned in ascending order of car group and descending order of maintenance interval.
- Write a statement which creates a view of the bookings table to include customer number, car group, model, date reserved, reserved by, date rental start, rental period and pay method.
- Select date bought for all cars in-group A2, display the date in a form similar to ' the 10th day of January, 1992'.
Return to Assignments