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



