Re:PRQL a simple, powerful, pipelined SQL replacement
by tremon on Friday December 30, 2022 @01:47PM
(#34188390)
I'm not sure I'd call that a footgun -- it's a fundamental property of relational algebra that relations are unordered.
That said, it's not universally true that subquery ordering is not propagated to the final result; in the absence of an ORDER BY clause, the query engine will return the results in whatever order is most convenient for execution. For example, this query:
select *, rank() over (partition by lastname order by firstname)
from employees;
will definitely return a result set ordered by lastname,firstname even though it's not explicitly specified (tested on MS' azure sql database).
That said, it's not universally true that subquery ordering is not propagated to the final result; in the absence of an ORDER BY clause, the query engine will return the results in whatever order is most convenient for execution. For example, this query:
will definitely return a result set ordered by lastname,firstname even though it's not explicitly specified (tested on MS' azure sql database).