28 August 2008

SQL select exercise 1

How to select the lowest value for each day that has a value? For instance, for the 2008-04-10, the lowest 'time' value is "09:15:00". What would be the SELECT statement that would produce a list of the lowest values per day, one value for each date?

Date; time
"2008-04-04";"16:00:00"
"2008-04-09";"08:45:00"
"2008-04-09";"12:45:00"
"2008-04-09";"17:45:00"
"2008-04-10";"09:15:00"
"2008-04-10";"12:55:00"
"2008-04-11";"09:15:00"
"2008-04-11";"12:50:00"
"2008-04-14";"10:15:00"
"2008-04-14";"12:45:00"
"2008-04-14";"14:55:00"
"2008-04-16";"08:10:00"
"2008-04-16";"10:10:00"
"2008-04-16";"10:50:00"
"2008-04-16";"14:20:00"
"2008-04-16";"15:50:00"
"2008-04-17";"10:00:00"
"2008-04-17";"13:30:00"
"2008-04-21";"09:45:00"