在postgresql中的between and操作符作用类似于,是包含边界的
a BETWEEN x AND y 等效于 a >= x AND a <= y
在postgresql中比较日期的方法有四种:
方法1:
select * from user_info where create_date >= '2015-07-01' and create_date <= '2015-08-15';
方法2:
select * from user_info where create_date between '2015-07-01' and '2015-08-15';
方法3:
select * from user_info where create_date >= '2015-07-01'::timestamp and create_date < '2015-08-15'::timestamp;
方法4:
select * from user_info where create_date between to_date('2015-07-01','YYYY-MM-DD') and to_date('2015-08-15','YYYY-MM-DD');