Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    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.



That’s not what a Turing tarpit is. It’s the opposite - a language tailored to a specific useful task.


"Everything is possible but nothing of interest is easy" describes SQL perfectly in my experience.


Why 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: