Re:A Short Story About SQL’s Biggest Rival
by sumtechguy on Friday October 09, 2020 @03:07PM
(#24733303)
I just wish they had flipped from and select around.
[ Parent
| on HN ]
Re:A Short Story About SQL’s Biggest Rival
by NickSharp on Friday October 09, 2020 @03:11PM
(#24733335)
Or "set" and "where"
Re:A Short Story About SQL’s Biggest Rival
by nendroid on Friday October 09, 2020 @03:13PM
(#24733348)
It's not about flipping. The two concepts are actually commutative. You could in theory create syntax that looks like this:
FROMCLAUSE * SELECTCLAUSE * WHERECLAUSE = SQLEXPRESSION
SELECTCLAUSE * WHERECLAUSE * FROMCLAUSE = SQLEXPRESSION
...
The issue is that not only does SQL syntax force an artificial order on these clauses, but that these clauses Cannot be decomposed to be used elsewhere. I cannot reuse a WHERECLAUSE or a SELECTCLAUSE in another expression.
Re:A Short Story About SQL’s Biggest Rival
by nendroid on Friday October 09, 2020 @08:01PM
(#24735627)
Some detail here. What goes on in relational algebra is that the FROMCLAUSE is encoded into an axiomatic primitive called a RELATION and you get stuff like this:
SELECTCLAUSE(WHERECLAUSE(relation)) = relation
WHERECLAUSE(SELECTCLAUSE(relation)) = relation
Basically every operation in relational algebra produces a primitive of type RELATION which allows for all operations to be composed like unix pipes.My example in the previous post has a flaw where it's not clear what:
SELECTCLAUSE * WHERECLAUSE = ????
will output because there's no meaning to a SQLEXPRESSION without a FROMCLAUSE. But hopefully it illustrates the point. I'm putting this here for anyone who's nitpicky about the details. The relational algebra syntax is much more elegant.