阿里云odps SQL

该博客介绍了ODPS SQL中TO_DATE和to_char函数的使用,展示了如何进行日期范围筛选。同时,讲解了交集、并集和补集的基本语法,包括intersect、union、except在数据查询中的应用,帮助理解ODPS的数据处理能力。
摘要由CSDN通过智能技术生成

odps官方网站

使用示例:

#使用TO_DATE
select *
from xx_bi.dwd_bi_wide_order_pay_record_detail_di where ds='20210711'
and payment_time  between TO_DATE('2021-07-09 00:00:00','yyyy-mm-dd hh:mi:ss') and TO_DATE('2021-07-09 23:59:59','yyyy-mm-dd hh:mi:ss')

#使用to_char
select *
from xx_bi.dwd_bi_wide_order_pay_record_detail_di where ds='20210711'
and to_char(payment_time,'yyyy-mm-dd hh:mi:ss') between '2021-07-09 00:00:00' and '2021-07-09 23:59:59'

交集、并集、补集

--取交集不去重。
<select_statement1> intersect all <select_statement2>;
--取交集并去重。intersect效果等同于intersect distinct。
<select_statement1> intersect [distinct] <select_statement2>;

--取并集不去重。
<select_statement1> union all <select_statement2>;
--取并集并去重。
<select_statement1> union [distinct] <select_statement2>;

--取补集不去重。
<select_statement1> except all <select_statement2>;
<select_statement1> minus all <select_statement2>;
--取补集并去重。
<select_statement1> except [distinct] <select_statement2>;
<select_statement1> minus [distinct] <select_statement2>;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值