3 ms·
CASE WHEN $2 BETWEEN 0 AND 100 AND $1 > 0 THEN (($1 - 1) * $2) ELSE 50 END What a wonderful, maintainable language
by lmm 2y ago
CASE
WHEN $2 BETWEEN 0 AND 100 AND $1 > 0
THEN (($1 - 1) * $2)
ELSE
50
END
What a wonderful, maintainable language for expressing logic in /s. Perfect for my COBOL on Cogs application.
The problem with SQL has never been that it's impossible to put logic in it. The problem is that it's a classic Turing Tarpit.
- lelanthran 2y agoWhy the `/s`? That's neither more nor less comprehensible than what I often see in python's built-in DSL within list comprehensions. At least the SQL variant has the excuse of being designed back when language design was still in its infancy. The madness in Python's list comprehensions and the ad hoc DSL in ruby has no such excuse.
- liontwist 2y agoThat’s not what a Turing tarpit is. It’s the opposite - a language tailored to a specific useful task.
- lmm 2y ago"Everything is possible but nothing of interest is easy" describes SQL perfectly in my experience.