首页 > 数据库技术 > 详细

Flink基础(130):FLINK-SQL语法 (24) DQL(16) OPERATIONS(13)ORDER BY clause/LIMIT clause

时间:2021-08-30 11:34:54      阅读:7      评论:0      收藏:0      [点我收藏+]

1 ORDER BY clause 

Batch Streaming

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 orders can be freely chosen. But there is no this limitation in batch mode.

SELECT *
FROM Orders
ORDER BY order_time, order_id

2 LIMIT clause

LIMIT clause constrains the number of rows returned by the SELECT statement. In general, this clause is used in conjunction with ORDER BY to ensure that the results are deterministic.

The following example selects the first 3 rows in Orders table.

SELECT *
FROM Orders
ORDER BY orderTime
LIMIT 3

 

Flink基础(130):FLINK-SQL语法 (24) DQL(16) OPERATIONS(13)ORDER BY clause/LIMIT clause

原文:https://www.cnblogs.com/qiu-hua/p/15195929.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!