Comment by mrjin
1 year ago
Starting with SELECT was a mistake in SQL as you need to know where before what to select from. What we really need is something like
FROM r JOIN s on r.Id = s.Id ORDER BY r.Id SELECT *
But the thing is, such changes will break pretty much all existing code, so the author added |> to distinguish, but why not use | instead? Don't make people typing one more character please.
Yes, being able to start with FROM is what makes this so intuitive to use (and autocomplete work better); your hypothetical
would indeed be pretty much that (linebreaks optional):
The question about “typing one more character” is answered in the paper's section 4.1.5 “Why use ‘|>’ for the pipe character?” (page 6): “The most natural and obvious choice would be to use ‘|’. Unfortunately…” — they don't want to break existing queries that use | for bitwise OR.
(I wonder if one day, if the majority of users are using pipe syntax and don't mind updating their old queries or adding a special directive to enable single pipe…)