I’ve uploaded the MS Word and PDF versions of a new paper about CASE expressions, which is really just a replacement for the earlier DECODE paper. This one has been an unexpected trial, probably because it was a bit of a chore that I knew I had to get round to because the DECODE approach is dated.
I’d like to thank the following people for sparing some of their time to read through the paper, checking it for accuracy and making some very useful suggestions for improvement. As usual, the final decisions and all of the mistakes are mine and there would have been more if it wasn�t for their efforts. Cheers, guys.
Andrew Campbell, Sun Microsystems
Colin Garside, BUPA
John Gilroy, Ask Jeeves
Jari Kuhanen, Sun Microsystems
If anyone else spots any errors or can suggest how the paper could be improved, feel free to post feedback on the website, post a comment here or drop me an email at dougburns@yahoo.com
Good paper.
G’day, thanks for a good paper.
On the first page the following query is given:
SELECT SUM(salary) FROM emp WHERE deptno IN (10,20) GROUP BY deptno;
It is a good example of what you’re talking about.
However (and this is a minor nitpick), because you haven’t included deptno in the select clause, you don’t know which sum is for which deptno (and GROUP BY should not be relied on to sort the results). Either deptno needs to be added to the SELECT clause, or an ORDER BY added.
Cheers
JK
Jeffrey,
You’re not nitpicking at all – good catch.
I’ve fallen for the same weakness again – I just ‘chucked that in at the last minute’ as an up-front example and (as is obvious from the lack of output) didn’t bother to run it. If I had, I would have noticed the obvious mistake. I’ll update the paper.
Thanks for letting me know.
Cheers,
Doug
Doug, the paper’s excellent, well done. I’ve downloaded it and filed it away for my next ETL project…
Thanks Mark. I wasn’t so sure about it myself – perhaps a bit too close to it. Maybe I’ll just never be happy with anything 😉
Still open for any improvement suggestions …
Cheers,
Doug
Good paper really. Thanks for elucidating clearly. It helped me greatly.