diff --git "a/20 \347\237\263\350\211\257\346\266\233/20231017 \345\205\254\347\224\250\350\241\250\350\241\250\350\276\276\345\274\217\344\270\216\347\252\227\345\217\243\345\207\275\346\225\260.md" "b/20 \347\237\263\350\211\257\346\266\233/20231017 \345\205\254\347\224\250\350\241\250\350\241\250\350\276\276\345\274\217\344\270\216\347\252\227\345\217\243\345\207\275\346\225\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..49f0e929bf5cc6e2fcfd1acc5be89daa52c29196 --- /dev/null +++ "b/20 \347\237\263\350\211\257\346\266\233/20231017 \345\205\254\347\224\250\350\241\250\350\241\250\350\276\276\345\274\217\344\270\216\347\252\227\345\217\243\345\207\275\346\225\260.md" @@ -0,0 +1,25 @@ +# 笔记 + + ##### timestampdiff(单位,a,b); (b-a)时间戳 + +​ 单位:年差(year),月差(month),天数(day),时差(hour),分(minute),秒(second),毫秒(microsecond)。 + +### 窗口大小 + +``` mysql + -- 开窗范围 + over(partition by 字段 rows between unbounded/preceding and current row) + + rows:启用窗口大小 + between...and... :区间范围 + n unbounded: 后n行 + n preceding: 前n行 + current row: 当前行 + n following: 指当前行之后的行 -- 1 following (当前行+后一行) + unbounded following: 最终行 +``` + +##### 分组 ntile(n) + +​ 分成n个等级,记录等级数。 +