I have this query. Sorry to bother you, I know it’s simple but I’m wracking my brain in order to solve it.
Consider a relation of scheme
Boat(ID,Name,Color,Age)
and a relation of scheme
Rent(IDBoat, IDClient, Date, Duration)
such that IDBoat is foreign key with respect to ID.
SQL: compute, for each boat, how many clients rent
the boat in the last month and for a duration greater than 1 hour.
My solution is:
SELECT IDBoat, COUNT (*), IDClient
FROM Rent
WHERE Date Between 2012-01-25
AND 2011-12-25
AND Duration > 1;
Is it correct?
Thanks a lot