oceanbase/unittest/sql/rewrite/or_expand.sql
oceanbase-admin cea7de1475 init push
2021-05-31 22:56:52 +08:00

24 lines
1.0 KiB
SQL

#case
select * from t1 where c1 > 0 or c2 < 0;
select * from t1 where c1 > 0 union all select * from t1 where c2 < 0 and lnnvl(c1 > 0);
#case 2
select * from t1 where c1 > 0 or c2 < 0 or c1 = 1;
select * from t1 where c1 > 0 union all select * from t1 where c2 < 0 and lnnvl(c1 > 0) union all select * from t1 where c1 = 1 and lnnvl(c1 > 0 or c2 < 0);
#case 3
select * from t1 where c1 > 0 or c2 < 0;
select * from t1 where c1 > 0 union all select * from t1 where c2 < 0 and lnnvl(c1 > 0);
#case 4
select * from t1 where c1 = 1 or c1 = 2 or c1 = 3;
select * from t1 where c1 = 1 union all select * from t1 where c1 = 2 and lnnvl(c1 = 1) union all select * from t1 where c1 = 3 and lnnvl(c1 = 1 or c1 = 2);
#case 5
select c2 from t1 where c1 = 1 or c1 = 2 or c1 = 3;
select c2 from t1 where c1 = 1 union all select c2 from t1 where c1 = 2 and lnnvl(c1 = 1) union all select c2 from t1 where c1 = 3 and lnnvl(c1 = 1 or c1 = 2);
#case 6
select * from t1 where c1 > 0 or c2 < 0;
select * from t1 where c1 > 0 union all select * from t1 where c2 < 0 and lnnvl(c1 > 0);