TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

SQL looks like English is a well intentioned error

22 pointsby Judyrabbitabout 1 year ago

11 comments

travemabout 1 year ago
I am no fan of the syntax of SQL, however the authors solution of making SQL more procedural is (imo) correctly identifying an issue but then reaching for the wrong tool to fix it.<p>When I am authoring SQL, I find the declarative and relational concepts extremely powerful and well suited to the problem I am solving.
评论 #39627827 未加载
评论 #39628705 未加载
mrkeenabout 1 year ago
&gt; and after GROUP, an extra BY needs to be written.<p>group &#x2F;= groupBy.<p>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&#x27;s case I think this is just limited to a column id, but I could be wrong.<p>&gt; The main downside of being like natural language is non procedural. Program logic is generally executed step by step<p>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.<p>All that would go out the window if the programmer had to write how to do things. Forget &#x27;repeatable read&#x27; or &#x27;linearisable&#x27; or any correctness guarantees provided by a database - if it&#x27;s up to the programmer to write <i>how</i>, not <i>what</i>, then your correctness guarantees are basically: &quot;I hope every programmer who touched this codebase took the right number of locks in the right order at the right time&quot;.
weatherlightabout 1 year ago
The authors argument that SQL&#x27;s english-like syntax is a &quot;well-intentioned error&quot; overlooks the accessibility it provides. SQL, inspired by relational algebra, enables set-based operations, distinct from procedural programming&#x27;s linear approach.<p>This is why SQL has endured for so long.<p>That mathematical base allows for efficient data manipulation across vast datasets.<p>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.<p>Emphasizing procedural over declarative concepts misinterprets SQL&#x27;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.<p>Side rant: I just wish SQL was more composable.
评论 #39628391 未加载
评论 #39628007 未加载
评论 #39628715 未加载
tarl0sabout 1 year ago
Lately I&#x27;ve been experimenting the usage of LLMs for the explainability of SQL stored procedures with exceptionally good results - think about identifying important fields, linking them to existing glossaries, expanding said glossaries, etc. I wonder how much SQL looking like natural language helped for my use case.
评论 #39627732 未加载
评论 #39627844 未加载
botpagabout 1 year ago
I find the author to be fairly out of touch with modern programming languages based on the assertions made in the article. But more importantly, I think leaning into procedural programming is a fundamental misunderstanding of the power of declarative syntax and also does not take advantage of the RDBMS’ biggest strength: the ability to think in sets.
torstenvlabout 1 year ago
While interesting, it&#x27;s hard to identify any component of the author&#x27;s argument that isn&#x27;t fundamentally flawed.<p>Ambiguity is not &quot;the true advantage&quot; of natural language and certainly not one we want a query language to adopt.<p>Pointing to the limits on the complexity of SQL queries most business folks can write overlooks the fact that <i>there are SQL queries that most business folks can write</i>.<p>Wanting to make SQL more procedural is a terrible idea, for all the reasons already expressed more eloquently in this thread than I can.
psacawaabout 1 year ago
Anyone who has had to sift through large BNFs such as [0, 1] to find that the syntax error was a syntactically significant &quot;TO&quot; knows that this is the case. Natural language has synonyms, computer languages really should avoid synonyms and also any spurious syntactic sugar.<p>[0] <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;13&#x2F;sql-altertable.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;13&#x2F;sql-altertable.html</a><p>[1] <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;13&#x2F;sql-commands.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;13&#x2F;sql-commands.html</a>
gregw2about 1 year ago
It perhaps is an error from the point of view of the ”leading reporting tooling vendor in China” <a href="https:&#x2F;&#x2F;www.scudata.com&#x2F;about-us&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.scudata.com&#x2F;about-us&#x2F;</a> which starting in 2007 built their own Java NoSQL data warehouse+sqllite?!) platform.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;SPLWare&#x2F;esProc">https:&#x2F;&#x2F;github.com&#x2F;SPLWare&#x2F;esProc</a> <a href="https:&#x2F;&#x2F;blog.scudata.com&#x2F;qa-of-esproc-architecture&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.scudata.com&#x2F;qa-of-esproc-architecture&#x2F;</a><p>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 <a href="https:&#x2F;&#x2F;c.scudata.com&#x2F;article&#x2F;1694595486828?p=1&amp;m=0" rel="nofollow">https:&#x2F;&#x2F;c.scudata.com&#x2F;article&#x2F;1694595486828?p=1&amp;m=0</a>
vendiddyabout 1 year ago
While I don&#x27;t agree with the conclusion of the article, I still wonder if there&#x27;s an alternative to SQL that is:<p>- declarative<p>- easy to understand<p>- scales well with the complexity of the query<p>Perhaps it could look and feel like a functional programming language but underneath uses the same execution engine as SQL<p>I&#x27;ve seen a few attempts at it, but none of them have clicked with me.<p>Thoughts?
pwdisswordfishcabout 1 year ago
English is indeed a well intentioned error, but why does SQL look like that?
评论 #39628057 未加载
Timwiabout 1 year ago
Cobol and Fortran kind of made the exact same well-intentioned error of trying to mimic English, despite being perfectly procedural.