Advertisement

结构化查询语言

阅读量:
复制代码
    1/Max()函数不能出现在where子句中
    2/select…from…where…group by having…order by…
    3/left join…允许为空的放在left join前面
    4/字符串用单引号’’
    5/MySQL四舍五入Floor
    6/保留3位小数位数round(,3)
    7/select子句中不能出现group by子句中未出现的列名
    8/limit 从0开始
    9/MySQL 比较两个Date,DATEDIFF(大,小)=1 
    
    
      
      
      
      
      
      
      
      
      
    

1.表table1(usr_id int,usr_dt string),其中id字段数值一致,需要确定表中用户连续活跃的天数,若出现不连续的情况,则当前行对应的连续活跃字段应标记为1,最终输出查询结果table2(窗口函数)

复制代码
    select uid,active_dt,c1
    	,count() over(partition by uid,c1 order by active_dt rows between unbounded preceding and current

全部评论 (0)

还没有任何评论哟~