--
-- ### Advanced conditions on btree objects  
-- 
--

drop if exists table t1;
create table t1 ( a int, b string(30));

create btree b1 on t1(a);

insert into t1 values ( 1, 'XXX');
insert into t1 values ( 2, 'XXX');
insert into t1 values ( 2, 'FFF');
insert into t1 values ( 3, 'XXX');
insert into t1 values ( 4, 'XXX');

select * from t1 where a = 2 and a < 10 and a >= 2;


drop if exists table t1;
create table t1 ( a int, b string(30), c string(20));

create btree b1 on t1(a,b,c);

insert into t1 values ( 2, 'AAAA', 'XXII');
insert into t1 values ( 2, 'XXX', 'XXX');
insert into t1 values ( 2, 'FFF', 'XXX');
insert into t1 values ( 3, 'GGG', 'XXX');
insert into t1 values ( 4, 'ZZZ', 'QQQ');

select * from t1 where a = 2 and b = 'FFF' and c = 'XXX' and a < 10;

select * from t1 where a = 2 and a > 1 and b < 'ZZZ' and  b = 'FFF' and b < 'XXX';	

drop if exists table t1;
create table t1 ( a int, b string(10));
create btree b1 on t1 ( a);


insert into t1 values ( 1, 'XXX');
insert into t1 values ( 2, 'XXX');
insert into t1 values ( 3, 'XXX');
insert into t1 values ( 4, 'XXX');
insert into t1 values ( 5, 'XXX');
insert into t1 values ( 6, 'XXX');
insert into t1 values ( 7, 'XXX');

insert into t1 values ( 8, 'XXX');
insert into t1 values ( 9, 'XXX');
insert into t1 values ( 10, 'XXX');

select * from t1 where a between 1 and 5 and a between 4 and 9;
select * from t1 where a between 1 and 5 and a between 4 and 9 and a = 4;
