栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

自用记事本

自用记事本

1.Oracle查索引SQL

select user_ind_columns.index_name,user_ind_columns. column_name, user_ind_columns.column_position,user_indexes. uniqueness from user_ind_columns,user_indexes where user_ind_columns. index_name = user_indexes. index_name and user_ind_columns. table_name = 'U_PT_DIM. DIM_ORG_STORE_CATEGORY' 

2.时间处理

  hive时间处理  

  系统时间 current_date() 2022-02-24

  系统时间的前一天 date_sub(current_date(),1) 2022-02-23 
                   unix_timestamp() 1645698714 秒     
                   from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss')  2022-02-24 18:32:46
                   from_unixtime(unix_timestamp(), 'yyyy/MM/dd HH:mm:ss') 2022/02/24 18:32:46
                   from_unixtime(unix_timestamp(), 'yyyyMMdd')        20220321
                   from_unixtime(unix_timestamp('2017-12-05','yyyy-mm-dd'),'yyyymmdd') 2022-02-24转20220224

                   to_date(列名(时间类型的))   to_date(create_time)   '2022-02-27'
                   month = substr(date_sub(current_date(),1),1,7)

                   unix_timestamp((date_sub(current_date(),14)),'yyyy-mm-dd'),'yyyymmdd') 算前几天的yyyymmdd格式

                  concat(from_unixtime(unix_timestamp((date_sub(current_date(),7)),'yyyy-mm-dd'),'yyyymmdd'),'~',from_unixtime(unix_timestamp((date_sub(current_date(),1)),'yyyy-mm-dd'),'yyyymmdd'))  算7天时间段   20220317~20220323

                  本月第一天 trunc(date_sub(current_date(),1),'MM') = date_sub(current_date(),1)
oracle时间处理 

                  系统时间 sysdate                   2022-02-24 18:26:15

                  系统时间的前一天 sysdate-1  2022-02-23 18:26:15 
                 TO_CHAr(sysdate,'yyyy-mm-dd')       2022-02-24          

                 TO_CHAr(sysdate-1,'yyyy-mm-dd')    2022-02-23

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/775517.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号