Hacker News new | past | comments | ask | show | jobs | submit
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.

I think this is a tad too contrarian. I think SQL does (did?) a great job of giving common-language terms for fundamental data table operations, which in turn creates a shared mental model that everyone can use to describe what can and should be done to tables.

I agree with you in terms of syntax, though, it leaves something to be desired. But learning SQL was a pretty fundamental step in my journey to becoming a data scientist. It helped form the basis for how I reason about tabular data.

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

While true on some level, I don't think this is a very useful statement. The importance of mathematical foundations lies in the extent to which they constrain the features of a programming language.

That extent is not the same for all languages. Many programming languages do not appear to be constrained by anything other than some pragmatic hunch of their designers plus the theoretical limits of computability.

SQL is a mess. The author acknowledged that. But the relational model and relational algebra are more serious attempts at creating a small but expressive theory than many of our mainstream programming languages.

> And SQL is very much a "fad" language - it just somehow managed to stick around.

Probably because - despite it not being perfect - the only people who have been able to do it better are very slight variations of it like LINQ and Logica and GoogleSQL etc.

loading story #48400747
loading story #48398609
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/

This looks somewhat similar to LINQ in how it order clauses.
SQL may not be perfect, but I think the biggest pain points come from databases themselves. Any changes to the table structure (like a simple column rename) breaks all your queries. Data versioning not supported. Documentation not supported out of the box...
loading story #48399498
Well put. SQL gets put in this category of foundational technology that has passed the test of time when in reality it’s more like an example of path dependence.
loading story #48399188