SQL looks like English is a well intentioned error
github.com
github.com
When I am authoring SQL, I find the declarative and relational concepts extremely powerful and well suited to the problem I am solving.
Changing SQL to a description of how you'll get the data would make a query incomprehensible to me.
SELECT age FROM Customers WHERE Country='Mexico'
Could be written something like: table.customers.filter(c=>c.country == "Mexico").age
The filter is kinda ugly, there is this strange assumption there to be only one Mexico in country.Clearly the most advanced approach is this:
//customer[country="mexico"]/age
1999!group /= groupBy.
Group just put things in groups. GroupBy allows for a function on the item to be used (think passing a custom comparator into a sort() function). In SQL's case I think this is just limited to a column id, but I could be wrong.
> The main downside of being like natural language is non procedural. Program logic is generally executed step by step
SQL has thrived on being non-procedural. It is high-level and abstract, and its various implementations make much better optimisations than would the average-idiot-programmer-in-a-hurry.
All that would go out the window if the programmer had to write how to do things. Forget 'repeatable read' or 'linearisable' or any correctness guarantees provided by a database - if it's up to the programmer to write how, not what, then your correctness guarantees are basically: "I hope every programmer who touched this codebase took the right number of locks in the right order at the right time".
This is why SQL has endured for so long.
That mathematical base allows for efficient data manipulation across vast datasets.
To his point that no other languages strive to be spoken like, languages like ruby (and python to a degree )have successfully adopted a natural, english-like syntax, enhancing readability and developer productivity.
Emphasizing procedural over declarative concepts misinterprets SQL's core advantage: expressing complex data relationships and manipulations succinctly. Such perspectives miss the broader utility of making programming languages approachable and efficient for diverse tasks and user backgrounds.
Side rant: I just wish SQL was more composable.
And, like you said, SQL kills one of the core ideas of RelAlgebra: composability.
I find it very sad that behind the scenes in most relational DBs, the mess off SQL gets translated to the operator language which the optimizer works with. Now, /that/ language is pure relational algebra complete with nice mathy properties.
Admittedly, I haven't looked at pgsql code for 10+ years so this could have changed.
The authors are from China so English is not a plus for accessibility in their market’s business users or analysts.
Heavily agree here. LLMs have significantly shortened the time it takes me to write complex queries.
Ambiguity is not "the true advantage" of natural language and certainly not one we want a query language to adopt.
Pointing to the limits on the complexity of SQL queries most business folks can write overlooks the fact that there are SQL queries that most business folks can write.
Wanting to make SQL more procedural is a terrible idea, for all the reasons already expressed more eloquently in this thread than I can.
https://github.com/SPLWare/esProc https://blog.scudata.com/qa-of-esproc-architecture/
Composibility aside, I’m more interested in their identification of limits of relational algebra and the alternative keywords they use for things difficult to optimize in SQL engines than their critique of using English. For that, see https://c.scudata.com/article/1694595486828?p=1&m=0
- declarative
- easy to understand
- scales well with the complexity of the query
Perhaps it could look and feel like a functional programming language but underneath uses the same execution engine as SQL
I've seen a few attempts at it, but none of them have clicked with me.
Thoughts?