3 ms·
> makes you specify the joins It not. SELECT * FROM "document", "line"; Is valid. "But what it do?" A CROSS JOIN. ie: a Cartesian product. That is not
by mamcx 8y ago
> makes you specify the joins
It not.
SELECT * FROM "document", "line";
Is valid. "But what it do?"
A CROSS JOIN. ie: a Cartesian product. That is not what most of the time you want.
Why cartesian? Because this is the most fundamental join of all. Is like "fold" in functional languages (ie: You implement map, filter, etc on top of fold).
Consider the JOIN clause a extra help. Not was always present:
https://stackoverflow.com/questions/25161747/how-to-implement-sql-joins-without-using-join https://stackoverflow.com/questions/25161747/how-to-implemen...
When using old fox pro, JOIN was not available.
----
Ok, but why not infer that if I join FROM "document", "line", it use the PKs??? That could be nice, but SQL is kind of EXPLICIT with not many implicit exceptions. And you don't wanna that behavior all the time.
This is in contrast to OO. Where you can only use a kind of "join", but lack the capabilities to do much more without extra work.
In fact, put JOINs not bother much. It fit well. Other aspect of the syntax of SQL are more annoying.
----
> If the answer is performance... SQL is not high-level
So, if you are on python, and use a generator to pipe several inputs instead of materialize each step in a big list and pass to the other, because I'm aware that is not memory efficient, suddenly is not high-level?
> I basically see SQL as an exercise in complexity, resulting from the constraints prevalent in the seventies. Please prove me wrong!
I say is the TOTAL OPPOSITE. Sql is TOO SIMPLE!
You are correct about it to be a product of the era. More exactly, the original plan was use SQL for the END USER to interface with the database. To write "off-shots" queries, not to be a proper programming interface.
That is why, SELECT come first, instead of Last. Also, why SQL can't be composed, you don't have variables, can't express loops or recursive functions, and many many other really annoying stuff. SQL is alike CSS. Too simple. Not even lisp-like capable.
P.D: Of course, exist a lot of extensions to cover for it (including WITH clauses), but the fact is, sql was not made for be a proper database language and it show.
Why is this relevant? Because SQL with a bit more power could be abstract and allowed to fix any small shortcoming more naturally.
----
I'm in the hunt to build a relational language, not tied to a particular RDBMS, with full programming power. Not follow the SQL syntax, but more the LINQ style:
http://tablam.org http://tablam.org
Still in research/alpha, and looking for help!