The
between
predicate specifies inclusive bounds for values in awhere
clause.Syntax
select * from ... where val between lower_bound and upper_boundThis expression is equivalent to:
select * from ... where val >= lower_bound and val <= upper_boundThe
not
operator can be added to an expression usingbetween
:select * from ... where val not between lower_bound and upper_boundwhich is equivalent to:
select * from ... where val < lower_bound or val > upper_boundExamples
create table t(i integer, d date); insert into t values([3,5],['2017-01-01','2017-02-01']); select * from t where i between 1 and 3; i d ------------------------------------------------------------------------------ 3 01/01/2017 00:00:00 Selected records: 1 select * from t where d between '2017-01-01' and '2017-01-30'; i d ------------------------------------------------------------------------------ 3 01/01/2017 00:00:00 Selected records: 1 select * from t where d between '2017-01-01' and now; i d ------------------------------------------------------------------------------ 3 01/01/2017 00:00:00 5 02/01/2017 00:00:00 Selected records: 2For more examples please see xSQL SDK sample
between
.