If the RentalDate is equal to the ReturnDate, then the number of rented days = 1.
If the ReturnDate is one day after the RentalDate, then number of rented days = 2,and so on.
For example, if the following statement updates the ReturnDate for the rentals with ID = 1 and ID = 2, the TotalAmount for these rentals should be updated as shown in the following
figure:
update Rentals
set ReturnDate = dateadd(day, 1, ReturnDate)
where RentallD in (1,2)
RentallD
1
2
CustomerID CarID
99
68
EmployeelD Rental Date
47 50
71
10
ReturnDate
TotalAmount
2023-04-11 135.00
RentalLocationID
13
2
ReturnLocationID
17
14
2023-04-09 2021-10-21
2021-10-25 300.00
Picture 9.1
Question 10:
Write statements to insert a category with CategoryName = 'Sport' and Rental PricePerDay = 100.3, then insert a car of the 'Sport' category with Maker = 'Chevrolet', Model = 'CorvetteStingray', Year = 2024, LicensePlate = '555-72HU', CurrentLocationID = null and Status = 'Available'.
Close
+ 100%
Zoom