
Journal Chacham's Journal: Verbiage: Solve AH + A = HEE in SQL 10
Solve AH + A = HEE (where each letter is representative of a distinct number). Easy enough? Now do it in SQL. Yes, this post is insane, but short and elegant.
SELECT H.n||E.n||E.n as H_E_E
FROM
(SELECT LEVEL-1 n FROM DUAL CONNECT BY LEVEL <=10) A,
(SELECT LEVEL-1 n FROM DUAL CONNECT BY LEVEL <=10) H,
(SELECT LEVEL-1 n FROM DUAL CONNECT BY LEVEL <=10) E
WHERE A.n NOT IN (H.n, E.n)
AND H.n NOT IN (A.n, E.n)
AND E.n NOT IN (A.n, H.n)
AND mod(H.n + A.n - E.n, 10) = 0
AND mod(A.n + trunc((H.n + A.n - E.n)/10)- E.n, 10) = 0
AND trunc((A.n + trunc((H.n + A.n - E.n)/10) - E.n)/10) = H.n
An Accountant's Answer (Score:2)
Re: (Score:1)
There's a sign here that perhaps answers that question.
IIRC, part of it states something like:
Please do not brush your teeth here
This is the kitchen
IT is very unhygienic for everyone
So, to answer your question, i want IT to be hygienic for everyone.
Doesn't work in postgresql (Score:2)
ERROR: syntax error at or near "n" at character 52
LINE 3: (SELECT LEVEL-1 n FROM DUAL CONNECT BY LEVEL
Re: (Score:1)
In Oracle, a similar construct would be SELECT Rownum -1 FROM User_Objects WHERE Rownum 11;
Meta-stupid question (Score:2)
If you say so (Score:2)
That was one reason I tried his statement, because I thought I'd learn something from it. I suppose I have!
Re: (Score:1)
Yes. In ANSI a recursive WITH could be used.
to Stupid Question Language?
Not sure why you are mocking Oracle on this. After all,Relational Software, Inc. (now Oracle Corporartion) was the first commercial implementation of SQL (1979) well before there was a standard.
Re: (Score:2)
Truly, I respect the functional style of programming embodied thereby, even though most of the work I do involves Microsoft Abcess.
Re: (Score:1)
I seem to be taking everything the wrong way today.
Re: (Score:2)