Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Why SQL syntax sucks, and why it matters (carlineng.com)
1 point by carlineng on Dec 30, 2022 | hide | past | favorite | 4 comments


This title is click-bait.

Despite that, I'm not convinced that SQL syntax sucks, and certainly not convinced by the specific rollup example in the blog post.

Personally, I find SQL easy to understand and flexible enough to achieve any result.

I haven't heard of Malloy before today, but to me the syntax just seems... different, not better. Maybe for someone who hasn't learned SQL yet, it would be better? I don't know, but have my doubts about that.

I'm not trying to say Malloy is bad (I haven't used it!), just that coming in with "SQL syntax sucks" seems like not a winning approach.


My hope with the post is to convince you that both the syntax and semantics of Malloy are more than just different, and indeed are actually better.

In the article, the SQL example results in output that cannot be used safely by downstream queries (i.e., it breaks algebraic substitution). This is generally true of any query in SQL that tries to aggregate along multiple levels of granularity. Malloy solves this limitation by making "nesting" of relations a first-class part of the language.


This blog post looks at SQL from the lens of data analysis, and provides a concrete example where it is seriously problematic.


I've always suspected SQL syntax sucks but I'm too much of an SQL noob to be fully convinced.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: