- 长数字日期转换为标准日期格式,如:20201101152019 转换为2020-11-01 15:20:19
from_unixtime(unix_timestamp(ext18,'yyyyMMddHHmmss'),'yyyy-MM-dd') //ext18字段为长数字日期
还有一种写法:
to_timestamp(hu_optime,'yyyyMMddHHmmss')
从json结构的字段中提取特定部分:
SELECT vin,vis_info,regexp_extract(vis_info, 'ecuVersion":"(\\w+)"',1) as ecu_version
from table_A
vis_info类似:
提取之后:
正则表达式regexp_extract
https://blog.csdn.net/jv_rookie/article/details/55211955hive中regexp_extract的用法总结
postgresql full join注意对关联的字段使用 COALESCE函数!!!!否则运行结果仍旧为left join。
即:不能直接select a.*,b.* from a full join b on a.id=b.id
,要写成
select coalesce(a.id,b.id) from a full join b on a.id=b.id
left join条件得写在where后面不能写在on后面,否则仍然显示左表所有数据。
在使⽤leftjoin时,on和where条件的区别如下:
1、on条件是在⽣成临时表时使⽤的条件,它不管on中的条件是否为真,都会返回左边表中的记录;
2、where条件是在临时表⽣成好后,再对临时表进⾏过滤的条件