One of DuckDB's key use cases is data science applications, where it's often used in combination with (or in place of) data frame libraries. These libraries often preserve row order between operations, which is also supported by DuckDB. See which operations preserve order:
https://duckdb.org/docs/sql/dialect/order_preservation
https://duckdb.org/docs/sql/dialect/order_preservation
Order Preservation
For many operations, DuckDB preserves the order of rows, similarly to data frame libraries such as Pandas. Example Take the following table for example: CREATE TABLE tbl AS SELECT * FROM (VALUES (1, 'a'), (2, 'b'), (3, 'c')) t(x, y); SELECT * FROM tbl; x y 1 a 2 b 3 c Let's take the following query that returns the rows where x is an odd number: SELECT * FROM tbl WHERE x % 2 == 1; x y 1 a 3 c Because the row (1, 'a') occurs before (3, 'c') in the original table, it is guaranteed to…
