ORDER BY Clause¶
Important
Confluent Cloud for Apache Flink®️ is currently available for Preview. A Preview feature is a Confluent Cloud component that is being introduced to gain early feedback from developers. Preview features can be used for evaluation and non-production testing purposes or to provide feedback to Confluent. The warranty, SLA, and Support Services provisions of your agreement with Confluent do not apply to Preview features. Confluent may discontinue providing Preview releases of the Preview features at any time in Confluent’s sole discretion. Check out Getting Help for questions, feedback and requests.
For Flink SQL features and limitations in the preview program, see Notable Limitations in Public Preview.
Confluent Cloud for Apache Flink®️ enables sorting rows from a SELECT statement.
Description¶
The ORDER BY
clause causes the result rows to be sorted according to
the specified expression(s). If two rows are equal according to the
leftmost expression, they are compared according to the next expression,
and so on. If they are equal according to all specified expressions,
they are returned in an implementation-dependent order.
When running in streaming mode, the primary sort order of a table must be ascending on a time attribute. All subsequent sort orders can be freely chosen.
When running in batch mode, there is no sort-order limitation.
Example¶
SELECT *
FROM orders
ORDER BY order_time, order_id