Mycat2 Sql兼容性 窗口函數(shù)

2021-09-09 14:24 更新

v1.17提供

不涉及跨數(shù)據(jù)庫的情況(即單表與全局表),Mycat的窗口函數(shù)使用方式與MySQL完全一致.
在涉及跨數(shù)據(jù)庫的情況下,MycatWindow不能下推變成SQL,所以在Mycat2內(nèi)進行計算匯總結(jié)果.

語法

function OVER ([[partition by column1] [order by column2] [RANGE|ROWS BETWEEN start AND end]])


function OVER partition by column1 order by column2 RANGE BETWEEN start AND end
function OVER partition by column1 order by column2 ROWS BETWEEN start AND end


COUNT(value [, value ]*) OVER 
COUNT(*) OVER 
AVG(numeric) OVER 
SUM(numeric) OVER
MAX(value) OVER
MIN(value) OVER
RANK() OVER 
DENSE_RANK() OVER
ROW_NUMBER() OVER 
FIRST_VALUE(value) OVER
LAST_VALUE(value) OVER 
LEAD(value, offset, default) OVER
LAG(value, offset, default) OVER 
NTILE(value) OVER

具體語義參考 https://dev.mysql.com/doc/refman/8.0/en/window-function-descriptions.html

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號