Mid Term Sample Questions Database II

1. Write a PL/SQL procedure to reduce the cost of each car by a percent that is passed

as an argument to the procedure.

 

2. Write a procedure to display three (3) Car_group_name and Rate_per_day values

that have the lest expensive Rate_per_day values listed in ascending order.

NOTE : You need a cursor so that you can FETCH the first three rows.

 

3. Write a trigger to display the customer number of customer when the customer tries to

book a car and has reserved at least one car in the last three days.

 

  1. Write a stored procedure that will insert new records into the Models table with columns (Model_name, Car_group_name, Description, Maint_miles) You should be able to excute the procedure by passing 4 values for the 4 columns in the Models table.

 

  1. Write a trigger to display the customer number and name if the customer has put on over 5,000 miles on the car that is being returned.

 

  1. Write a procedure that accepts a booking number as input then computes the amount

due and assigns it to v_amount_due. The computation of amount due is:

Rental_period*Rate_per_day + (Miles_in - Miles_out)*Rate_per_mile. It then

outputs the v_amount_due to the screen.

Note : You may not use the Amount_due column in this problem.