使用示例:
#使用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>;