Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL: Duration Question
Michel Cadot wrote:
> "Charles Hooper" <hooperc2000_at_yahoo.com> a écrit dans le message de news: 1165157716.914074.210880_at_80g2000cwy.googlegroups.com...
>
> <snip>
>
> | Charles Hooper
> | PC Support Specialist
> | K&M Machine-Fabricating, Inc.
> |
>
> I don't fully read your answer but you can't give any answer until
> my previous question is not itself answered:
>
> "If for a car you have a trip from 1:00 to 1:30 and for another one
> a trip from 1:35 to 1:50, do you have 1 or 2 cars for 01 slot?"
>
> Moreover you made the assumption that trips are recorded at
> the second, in the real world it is more likely at the minute (or
> even more likely at the quarter of hour).
> You also made many other assumptions.
> Finally, you answered a problem but this may not be the OP one.
>
> Regards
> Michel Cadot
There are indeed assumptions in my response. One of those assumptions is that seconds should NOT affect the outcome of the results, even if the original data captures the seconds. The SQL statement that I posted discards the seconds from the calculations.
Using my example, if the plant manager comes to me and asks, how many of my machines were in use between 6 AM and 7 AM, is there any possibility that the plant manager would want to count the 01 resource twice? My response makes the assumption that a machine in use is ONE machine in use, and provided a means of retrieving the result of double or triple counting a machine if desired.
You are correct that the SQL solution that I provided may not be the one that the OP wanted, and I stated as much in the reply. My post was intended to demonstrate the logic of raw data being transformed, and seeing the transformation, as a solution is developed. Jumping directly from the start of my response to the end of my response will likely yield an invalid solution for some other problem.
This is similar to the thought processes that go into solving mathematical proofs. Years ago, a mathematics professor wrote out a proof that showed that without a doubt that 1=2. If one jumps directly from the problem to the solution, a bit of the magic is lost.
Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc.
Received on Sun Dec 03 2006 - 11:51:22 CST
![]() |
![]() |