45 lines
877 B
Plaintext
45 lines
877 B
Plaintext
drop table if exists t1;
|
|
select 1+2 c1;
|
|
c1
|
|
3
|
|
select 1+2 as c1;
|
|
c1
|
|
3
|
|
select 1 c1;
|
|
c1
|
|
1
|
|
select 1 as c1;
|
|
c1
|
|
1
|
|
select 1+2 c1 from dual where 1=1;
|
|
c1
|
|
3
|
|
select 1+2 as c1 from dual where 1=1;
|
|
c1
|
|
3
|
|
select 1 c1 from dual where 1=1;
|
|
c1
|
|
1
|
|
select 1 as c1 from dual where NULL is NULL;
|
|
c1
|
|
1
|
|
create table t1(c1 int primary key, c2 int);
|
|
insert into t1 values(1,1),(2,1);
|
|
select c2 +100 c3 from t1 where c1=1;
|
|
c3
|
|
101
|
|
select c2 -100 c3 from t1 where c1 in (1,2);
|
|
c3
|
|
-99
|
|
-99
|
|
drop table t1;
|
|
create table t1(c1 int,c2 varchar(1024),c3 float,c4 datetime(6),c5 int,c6 varchar(1024),c7 float, primary key(c1,c2));
|
|
insert into t1 (c1,c2,c3,c5,c6,c7) values(1,'s',1.5,1,'t',2.5);
|
|
select c5+1 c51,c6 c61,c7+1 c71 from t1 where c1=1 and c2='s' and c3=1.5;
|
|
c51 c61 c71
|
|
2 t 3.5
|
|
select c5+1 c51,c6 c61,c7+1 c71 from t1 where c1=1 and c2='s' and c3=1.5 and c5 in (1,2,3);
|
|
c51 c61 c71
|
|
2 t 3.5
|
|
drop table t1;
|