SQL is the perfect interface
dangoldin.com
dangoldin.com
Also, relational database design is hard to wrap your mind around at first - but once it clicks it's quite the eureka moment. I think people forget that it is a learned pattern and can be frustrating to someone who hasn't taken the time to learn, so the alternative of a NoSQL db is much more attractive.
SQL as a language? Meh. Powerful but often clunky and many of the most powerful constructs are implementation specific (support CTE's vary a lot). It always strikes me that almost every project seems to ditch direct SQL coding for ORM's. The best code interface to SQL I've found is Elixir's Ecto project, which turns functional constructs into appropriate SQL statements. Otherwise both Postgres and MySQL use proprietary binary wire formats. New DB's like cockroachdb choose an existing binary protocol, or use ODBC. Not really sql interfaces, as in the textual ansi standard.
Still it seems like an industry standard around something like RethinkDB's query AST supporting generalized set of tuple-calculus or relational algebra operations and extra features could provide a much better and consistent code-to-DB interface. Then whether it's a key-value store supporting only a few operations or a full "SQL" interface, it could possibly enable much more innovation and even cooperation. For example, a relational-algebra functional DSL or sql-text interface could be used on the same data store. The one major missing feature in this scheme would be transactions, though it's almost certain the mathematics for describing transactions on datasets has been hashed out many times.
I'll just come out and say it, modern SQL amazing and powerful but it is not a good language. The language spec shows a weird obsession with "natural language" style programming, sometimes at the cost of safety, consistency and expressiveness. It is not a good language to generate by code, nor to use directly on the command line. It is not a good language to efficiently access your stored data, nor to express relational algebra. But you're going to have to learn it, and modern databases do amazing things with it to make it work.
Then it would be FROM X join Y on .. join Z on .. join (..) as T SELECT X.A, Y.B WHERE ..
I guess it's jarring but that's due to me not being used to it. Some people prefer doing joins using there where clause in which case the FROM ends up being in closer to location to the WHERE.
In fact I would put the select after the where clause:
from t
where x = 'y'
select a, b, c
order by a, b, c select b, max(a) as ma
from t
group by b
where ma > 100
ERROR: column "ma" does not exist
You would have to use the having clause: select b
from t
group by b
having max(a) > 100Every time I seen an ORM used it ended up causing performance problems and/or needed hand-optimized SQL.
Regardless, SQL rules.