logoalt Hacker News

wodenokototoday at 9:09 AM1 replyview on HN

I think the pretext of this articles is ridiculous.

Yes, SQL is based around relational algebra, but all programming languages are built on a theoretical foundation.

And SQL is very much a "fad" language - it just somehow managed to stick around. The goal was not some sort of mathematical purity, but rather to built a natural language data interface (sounds like something currently very hyped?) and it failed spectacularly at that goal.

It is so far from natural language that English speakers with statistical understanding won't be able to read it, but it is also inconsistent enough in its grammar design that it is unreasonably difficult to learn and needs large refactoring every time you want to query into the result of a query.

To continue my rant: Sometimes '=' is an identity test, sometimes it is `==`. Sometimes groups are called groups, sometimes they are partitions.

When creating a CTE, you put the name before "AS", but when creating a column, you put the name after "AS".

SQL is great because it is everywhere and it is definitely good enough, but it is not something great, that transcends other programming languages.


Replies

flosslytoday at 9:45 AM

I found PRQL[1] to be good fix for nearly everything I dont like about SQL.

But then it's only a query lang (DDL you still do in SQL then I guess).

Bottom line for me now is that I dont write much of my SQL by hand. AI does a much better job at it. I just read it back and point out mistakes and/or inefficiencies.

1: https://prql-lang.org/