4 ms·
> SQL is the most expressive language ever for querying and manipulating data, and in the right hands, that power can make hard things easy. ... what? The most
by xyzzy_plugh 6y ago
> SQL is the most expressive language ever for querying and manipulating data, and in the right hands, that power can make hard things easy.
... what? The most expressive language ever?? You're kidding.
Python? Scala? R? Julia? Java? Rust??
I mean, SQL is fine and all, and folks keep trying to unseat it which I feel is folly but to call it the most expressive language... Not even close.
SQL is rigid and structured. Basic math and string operations are frustrating at best. It's a small, easy to learn and powerful language. But it's far from expressive.
edit: a lot of replies are implying I took the quote out of context, allow me to apologize:
For manipulating and querying data, SQL is not the most expressive language ever, I wouldn't even call it expressive. It's baroque, rigid, and structured. Spark (with e.g. Scala) is far and away a more expressive framework/language than SQL ever will be. Python with pandas is far and away a more expressive framework/language than SQL ever will be. The list goes on.
I'm not trying to shit on SQL -- I live and breath it and I wouldn't be making money doing what I'm doing without it -- but it's not expressive.
Take a look at the first lines of the Wikipedia article[0] for Expressiveness (referred to as Expressive Power):
> In computer science, the expressive power (also called expressiveness or expressivity) of a language is the breadth of ideas that can be represented and communicated in that language. The more expressive a language is, the greater the variety and quantity of ideas it can be used to represent.
I get what the author is trying to say, but expressiveness is the wrong term. Datalog is arguably more expressive than SQL.
[0] https://en.wikipedia.org/wiki/Expressive_power_(computer_science) https://en.wikipedia.org/wiki/Expressive_power_(computer_sci...
- brandur 6y ago(Author here.) I think you're confusing a couple different major classes of languages — declarative versus procedural. I said specifically "most expressive ever for querying and manipulating data", and I'd stand by that. The nice part about SQL compared to the languages you've cited is that you just need to specify the "what" and not the "how". I tell it what data to fetch, where I want it from, how I wanted it grouped/sorted (etc.), and the engine figures out the best (and probably a very efficient) way to do that. This is different from a procedural language like Python or Rust where it'd be on me to also define every implementation detail — get data from here, join by doing this and with that algorithm, sort what comes out, ... This gives SQL a number of very nice properties: * It's very fast and succinct to write. * Even very complex queries are likely to be executed as optimally as they can be (because database engines tend to be very good at this). * It's so high-level that it can actually get more performant over time. See for example Postgres 12, which eliminated an optimization fence for CTEs (common table expressions) [1], which means that a lot of queries got faster automatically, without the user having to do _anything_. I love a lot the languages you listed, but SQL is a different animal, and amazing in a way that's quite unique. --- [1] https://info.crunchydata.com/blog/with-queries-present-future-common-table-expressions https://info.crunchydata.com/blog/with-queries-present-futur...
- xyzzy_plugh 6y agoI don't know. Procedural and declarative languages can both query and manipulate data. Maybe I'm being pedantic, but that's not my intent. For all of SQL's warts, it is the golden standard, and I agree with most everything else you say (it's succinct, easy to get optimal behavior, etc.) but compared to what you can express with Spark in Scala, it's not the end-all-be-all of expressivity. In fact, several SQL-compatible query engines have extended SQL to allow you to do work around its limitations and manually hint at what you want the engine to do. And even then, there are tons of situations where you fight the engine to do what you want. If I had a nickle for every Data Scientist or Finance person I unblocked because what ends up being a recursive join was making their query run time infinite...
- heelix 6y agoYou can call Java from Oracle's PSQL, so that makes it a super set including Java, right? :P (I've done things I'm ashamed of)
- EdwardDiego 6y agoOur sysop loved PG/Perl for stored procs...
- rubiquity 6y agoYou took the author's quote out of context despite pasting/typing in the entire quote, which means you either did that on purpose or you copy-paste/type things without reading them. Twice.
- jacobwilliamroy 6y agoI like sql a lot. It makes sense to me. But I also really like discrete math and set builder notation, so that might have something to do with how much I like sql, because I build my queries up as if querying the database were a discrete math problem.