RE: Oracle 10G
Posted in 2004
Topics: General Discussion
Since no one else tried it, here's a solution that immediately came to
mind:
The red hair remark tells that the oldest has no twin.
The question do you have any children indicates that he did not have any
older than 20.
Table
Create table kid_ages
(
oldest smallint,
middle smallint,
youngest smallint)
dataset
o m y
12, 3, 1
9, 4, 1
9, 2, 2
etc.
select * from kid_ages
where oldest + middle + youngest = number of windows counted
--EEM
-----Original Message-----
From: Daniel Morgan [mailto:damorgan@x.washington.edu]
Sent: Wednesday, March 03, 2004 7:46 PM
To: informix-list@iiug.org
Subject: Re: Oracle 10G
Obnoxio The Clown wrote:
> Yeah, that's true, Oracle is so difficult and incomprehensible, you do
need
> to be a rocket scientist to work with it. And since NASA is not doing
that
> well at the moment...
What is difficult for some ... is easy for others. The difficulty
in the program is not the database. The course would be equally
difficult taught with any RDBMS. The difficulty is that we teach
problem solving skills: Not just syntax.
Here's a problem given to students last night. As solvable in Informix
as in Oracle: Go for it.
====================================================================
Two mathematicians (Boris and Vladimir) met accidently for the first
time in 20 years.
They greet each other and begin catching up on their respective lives.
Boris asks Vladi
"Do you have any children?" "Yes" replies Vladimir, "I have three." "How
old are they?", asks Boris.
"The product of their ages is 36 and the sum of their ages is equal to
the number of windows on that building across the street." Boris looks
at the building, counts the windows then says "Vladi, that still doesn't
tell me the ages." "Ah, says Vladi, then I must tell you that the eldest
has red hair." "Oh", says Boris, "now I know their ages." What are the
ages of Boris' children?
====================================================================
Create a table, load it with data, and write a single SQL statement to
produce the data set required to deduce the answer ... then deduce away!
--
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan@x.washington.edu
(replace 'x' with a 'u' to reply)
sending to informix-list
Everett Mills wrote:
> Since no one else tried it, here's a solution that immediately came to
> mind:
>
> The red hair remark tells that the oldest has no twin.
> The question do you have any children indicates that he did not have any
> older than 20.
>
> Table
>
> Create table kid_ages
> (
> oldest smallint,
> middle smallint,
> youngest smallint)>
> dataset
> o m y
> 12, 3, 1
> 9, 4, 1
> 9, 2, 2
> etc.
>
> select * from kid_ages
> where oldest + middle + youngest = number of windows counted>
> --EEM
Nice to see. Here's one solution from that 'other' group:
STEP 1) CREATE TABLE ages (age NUMBWER);
STEP 2) INSERT INTO ages VALUES (1);
...
INSERT INTO ages VALUES (36);COMMIT;
STEP 3)
select a1, a2, a3
from (select c1.age a1, c2.age a2, c3.age a3, c1.age + c2.age + c3.age
totals
from ages c1, ages c2, ages c3
where c1.age * c2.age * c3.age = 36
and c1.age <= c2.age
and c2.age <= c3.age) t1
where exists (
select *
from ages c1, ages c2, ages c3
where c1.age * c2.age * c3.age = 36
and c1.age <= c2.age
and c2.age <= c3.age
and c1.age + c2.age + c3.age = t1.totals
having count(*) > 1)
and a3 > a1
and a3 > a2;
--
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan@x.washington.edu
(replace 'x' with a 'u' to reply)