I was wondering if anyone could help me with the following SQL questions:
1.Which car was rented for the longest single period? (regno)
SELECT regno, MAX(datein-dateout) "Longest Single Period" FROM rental group
Although this works - it shows ALL the regno's longest periods - how would i
just display the regno?
2. Which car was rented for the longest total period? (regno)
3. Which customers (if any) were born on Monday? (surname)
For this question i thought that this would work:
SELECT * FROM cust WHERE TO_CHAR(cd_o_b,'DAY') = 'MONDAY'
But it never works - it says 'no rows selected'
although there are 2 cusotmers born on Monday
However if you put wednesday instead of monday or any other day it seems to
Anyone know why this is?
4. Which customer averaged the most miles/day? (surname)(single rental)
5. Which customer averaged the least miles/day? (surname)(single rental)
6. Which customer had to wait for the previous renter to return the car?
6. What % of rentals are for one day only?
7. Can cars be rented on a Sunday? (i.e. are there any?) (regno)
8. List the total amount of money paid to each garage during this period.
9. What is the average miles driven per day?
The rest of the questions just baffle me as i cannot work them out at all.
If you can give me any help at all it would be very much appreciated!
The data/tables are defined below:
Any help would be very much appreciated!
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
pgsql-novice by date
|Next:||From: Rasputin||Date: 2001-12-10 09:48:32|
|Subject: securing Postgres|
|Previous:||From: Francisco Reyes||Date: 2001-12-09 19:31:16|
|Subject: Multiple '<>' on OR condition not working|
pgsql-sql by date
|Next:||From: Bruce Momjian||Date: 2001-12-10 10:33:01|
|Subject: Re: Trigger for logging stuff...|
|Previous:||From: Christopher Kings-Lynne||Date: 2001-12-10 02:32:56|
|Subject: Re: [SQL] how to change the type |