POV-Ray : Newsgroups : povray.off-topic : Dr POV-Ray : Re: Dr SQL Server Time
6 Sep 2024 11:19:50 EDT (-0400)
  Re: Dr SQL  
From: Invisible
Date: 23 Feb 2009 07:34:52
Message: <49a297ec$1@news.povray.org>
scott wrote:
>> OK, here we go. Using a sub-select, you can find the "previous" event 
>> in the log something like this:
>>
>>   SELECT *
>>   FROM EventLog X, EventLog Y
>>   WHERE
>>     X.ExperimentID = Y.ExperimentID AND
>>     Y.Timestamp =
>>     (
>>       SELECT MAX(Timestamp)
>>       FROM EventLog Z
>>       WHERE
>>       Z.ExperimentID = X.ExperimentID AND
>>       Z.Timestamp < X.Timestamp
>>     )
> 
> <snip>
> 
>> ...if that makes *any* sense at all?
> 
> I'll have to read and work through it some more for it to all make 
> sense, but it does make me realise that almost anything I want to get 
> from my data should be possible with SQL - something which I was not 
> sure about at the start!

There are few things that SQL cannot do. There are many, many things 
that *look* like you can't do them, but with a little trickery you can 
do a surprising amount using a purely declarative, set-at-once approach 
using SQL. It's a very powerful data manipulation paradigm. ;-)



Indeed, I spent much of my time at uni teasing through tricky SQL 
problems. It can be quite an exciting challenge. Now I'm not saying I 
was the teacher's pet, but I do remember sitting in a lecture hall 
containing about 40 people, and the lecturer saying

"And for this reason, we have various forms of normalisation. There's 
1st normal form, 2nd normal form, and so forth upto something like 6th 
normal form, with each one less redundant than the one before. However, 
for all practical purposes, you only really need to worry about 
Boyce-Codd normal form, which says - ANDREW..."

[I stand up]

"...every determinent is a candidate key..."

[I sit down]

"...thank you Andrew. Now, what that means is[...]"



One thing that SQL can't handle - as far as I know - is relationships 
which are arbitrarily recursive. The classic example is where you have a 
part that's made up of several other parts, which in turn are make up of 
smaller parts, etc. It's trivial to find all sub-parts down to a given 
level of recursion, but AFAIK impossible to recurse until you can't 
recurse any further.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.