Re: How would Homer write an SQL query?
Date: 2000/03/08
Message-ID: <slrn8ccsdo.qh0.news_at_teebee.mediaconsult.com>#1/1
On 8 Mar 2000 01:14:38 GMT, Patrick Ryan <pat_at_halcyon.com> wrote:
>select recited.tale from recited, muse, hero, deed, city
>where hero.trait = 'ingenious' and deed.hero_id = hero.hero_id and
>deed.actitivty = 'Sacked' and recited.recital_id = deed.recital_id and
>city.city_id = deed.city_id and city.city_name = 'Troy' ;
You don't have anything about travelling far and wide. You could be picking any ingenious hero who sacked Troy, even if he then sat down and did nothing!
>: "Tell me, O Muse, of that ingenious hero who travelled far and wide after he
>: had sacked the famous town of Troy."
connect muse
go
select person.*, personality.*, deed.*
from person, deed, personality
where person.id in
(
select person.id
from person, deed as before, deed as after, personality
where personality.trait='ingenious'
and personality.trait='hero'
and person.id=personality.id
and before.action='sack'
and before.location='Troy'
and before.who=person.id
and after.action='travel'
and after.date > before.date
and after.who=person.id
)
go
How's that? It needs some post filtering to make it look nice, though.
>: Please send your attempt to mailto:c.chesher_at_unsw.edu.au
Posted and Mailed.
-- rob partington % programmer % guideguide.com http://guideguide.com/ mailto:rpartington_at_guideguide.comReceived on Wed Mar 08 2000 - 00:00:00 CET
