Re:We Can Do Better Than SQL
by RedCrowbar on Thursday May 09, 2019 @04:06PM
(#19871843)
In EdgeQL, expressions are element-wise functions over the cross-product of the input sets:
edgedb> SELECT {'First', 'Second'} ++ '!';
{'First!', 'Second!'}
EdgeQL queries are essentially set comprehensions.
Re:We Can Do Better Than SQL
by tathougies on Thursday May 09, 2019 @04:19PM
(#19871988)
Right, so SELECT Table1 and SELECT 1 compose to SELECT Table1, 1 in the same way that
SELECT 1
and SELECT * FROM TABLE1 and SELECT 1 compose to
> SELECT * FROM TABLE1, (SELECT 1)
Aside from the different syntax, it is the same kind of composition. Not sure what EdgeQL has gained here, then.
SELECT Table1, 1
returns each row of Table1 along with 1 and that 1 returns the set {1} means that you have arbitrarily assigned each row of Table1 a row from the set {1}. This gives what you want in the case of a scalar, but what about a non-scalar.
For example, suppose Table1 contains (John, Smith), (Alice, Perkins), (Bob, Best). Then, what should
SELECT Table1, {1,2}
return? If you do not say cross product, you have arbitrarily assigned rows to one another, resulting in meaningless data. If you say cross product, then you have rewritten the sql expression
SELECT * FROM Table1, (VALUES (1), (2))
I don't disagree the SQL syntax is longer and has some unnecessary keywords, but unlike EdgeQL, the query means something particular.