1ex1:
2SELECT * FROM `objects`
3WHERE (date_field BETWEEN '2010-01-30 14:15:55' AND '2010-09-29 10:15:55')
4
5ex2:
6WHERE
7 requireddate BETWEEN
8 CAST('2003-01-01' AS DATE) AND
9 CAST('2003-01-31' AS DATE);
1select * from hockey_stats
2where game_date between '2012-03-11 00:00:00' and '2012-05-11 23:59:00'
3order by game_date desc;
1-- With implicit CAST
2SELECT * FROM my_table
3 WHERE my_date BETWEEN '2021-06-01 01:12:00' AND '2021-06-30 23:59:59';
4-- is EQUIVALENT to
5SELECT * FROM my_table
6 WHERE my_date >= '2021-06-01 01:12:00' AND my_col <= '2021-06-30 23:59:59';
1SELECT * FROM `objects`
2WHERE (date_field BETWEEN '2010-01-30 14:15:55' AND '2010-09-29 10:15:55')