📄 implicitconversions.sql
字号:
values '1.1', cast(1 as bigint);values cast(1.1 as real), 'a';values 'a', cast(1.1 as real);values cast(1.1 as double precision), 'a';values 'a', cast(1.1 as double precision);values 1.1, 'a';values 'a', 1.1;values true, 'a';values 'a', true;values date('1996-09-09'), 'a';values 'a', date('1996-09-09');values time('11:11:11'), 'a';values 'a', time('11:11:11');values timestamp('1996-09-09 11:11:11.5'), 'a';values 'a', timestamp('1996-09-09 11:11:11.5');-- comparisons at the language levelselect si from all1 where cast(1 as smallint) = 'a';select si from all1 where cast(1 as smallint) = '1.1';select si from all1 where cast(1 as smallint) > 'a';select si from all1 where cast(1 as smallint) > '1.1';select si from all1 where cast(1 as smallint) >= 'a';select si from all1 where cast(1 as smallint) >= '1.1';select si from all1 where cast(1 as smallint) < 'a';select si from all1 where cast(1 as smallint) < '1.1';select si from all1 where cast(1 as smallint) <= 'a';select si from all1 where cast(1 as smallint) <= '1.1';select si from all1 where cast(1 as smallint) <> 'a';select si from all1 where cast(1 as smallint) <> '1.1';select si from all1 where 'a' = cast(1 as smallint);select si from all1 where '1.1' = cast(1 as smallint);select si from all1 where 'a' > cast(1 as smallint);select si from all1 where '1.1' > cast(1 as smallint);select si from all1 where 'a' >= cast(1 as smallint);select si from all1 where '1.1' >= cast(1 as smallint);select si from all1 where 'a' < cast(1 as smallint);select si from all1 where '1.1' < cast(1 as smallint);select si from all1 where 'a' <= cast(1 as smallint);select si from all1 where '1.1' <= cast(1 as smallint);select si from all1 where 'a' <> cast(1 as smallint);select si from all1 where '1.1' <> cast(1 as smallint);select si from all1 where cast(1 as int) = 'a';select si from all1 where cast(1 as int) = '1.1';select si from all1 where cast(1 as int) > 'a';select si from all1 where cast(1 as int) > '1.1';select si from all1 where cast(1 as int) >= 'a';select si from all1 where cast(1 as int) >= '1.1';select si from all1 where cast(1 as int) < 'a';select si from all1 where cast(1 as int) < '1.1';select si from all1 where cast(1 as int) <= 'a';select si from all1 where cast(1 as int) <= '1.1';select si from all1 where cast(1 as int) <> 'a';select si from all1 where cast(1 as int) <> '1.1';select si from all1 where 'a' = cast(1 as int);select si from all1 where '1.1' = cast(1 as int);select si from all1 where 'a' > cast(1 as int);select si from all1 where '1.1' > cast(1 as int);select si from all1 where 'a' >= cast(1 as int);select si from all1 where '1.1' >= cast(1 as int);select si from all1 where 'a' < cast(1 as int);select si from all1 where '1.1' < cast(1 as int);select si from all1 where 'a' <= cast(1 as int);select si from all1 where '1.1' <= cast(1 as int);select si from all1 where 'a' <> cast(1 as int);select si from all1 where '1.1' <> cast(1 as int);select si from all1 where cast(1 as bigint) = 'a';select si from all1 where cast(1 as bigint) = '1.1';select si from all1 where cast(1 as bigint) > 'a';select si from all1 where cast(1 as bigint) > '1.1';select si from all1 where cast(1 as bigint) >= 'a';select si from all1 where cast(1 as bigint) >= '1.1';select si from all1 where cast(1 as bigint) < 'a';select si from all1 where cast(1 as bigint) < '1.1';select si from all1 where cast(1 as bigint) <= 'a';select si from all1 where cast(1 as bigint) <= '1.1';select si from all1 where cast(1 as bigint) <> 'a';select si from all1 where cast(1 as bigint) <> '1.1';select si from all1 where 'a' = cast(1 as bigint);select si from all1 where '1.1' = cast(1 as bigint);select si from all1 where 'a' > cast(1 as bigint);select si from all1 where '1.1' > cast(1 as bigint);select si from all1 where 'a' >= cast(1 as bigint);select si from all1 where '1.1' >= cast(1 as bigint);select si from all1 where 'a' < cast(1 as bigint);select si from all1 where '1.1' < cast(1 as bigint);select si from all1 where 'a' <= cast(1 as bigint);select si from all1 where '1.1' <= cast(1 as bigint);select si from all1 where 'a' <> cast(1 as bigint);select si from all1 where '1.1' <> cast(1 as smallint);select si from all1 where cast(1.1 as real) = 'a';select si from all1 where cast(1.1 as real) > 'a';select si from all1 where cast(1.1 as real) >= 'a';select si from all1 where cast(1.1 as real) < 'a';select si from all1 where cast(1.1 as real) <= 'a';select si from all1 where cast(1.1 as real) <> 'a';select si from all1 where 'a' = cast(1.1 as real);select si from all1 where 'a' > cast(1.1 as real);select si from all1 where 'a' >= cast(1.1 as real);select si from all1 where 'a' < cast(1.1 as real);select si from all1 where 'a' <= cast(1.1 as real);select si from all1 where 'a' <> cast(1.1 as real);select si from all1 where cast(1.1 as double precision) = 'a';select si from all1 where cast(1.1 as double precision) > 'a';select si from all1 where cast(1.1 as double precision) >= 'a';select si from all1 where cast(1.1 as double precision) < 'a';select si from all1 where cast(1.1 as double precision) <= 'a';select si from all1 where cast(1.1 as double precision) <> 'a';select si from all1 where 'a' = cast(1.1 as double precision);select si from all1 where 'a' > cast(1.1 as double precision);select si from all1 where 'a' >= cast(1.1 as double precision);select si from all1 where 'a' < cast(1.1 as double precision);select si from all1 where 'a' <= cast(1.1 as double precision);select si from all1 where 'a' <> cast(1.1 as double precision);select si from all1 where 1.1 = 'a';select si from all1 where 1.1 > 'a';select si from all1 where 1.1 >= 'a';select si from all1 where 1.1 < 'a';select si from all1 where 1.1 <= 'a';select si from all1 where 1.1 <> 'a';select si from all1 where 'a' = 1.1; select si from all1 where 'a' > 1.1;select si from all1 where 'a' >= 1.1; select si from all1 where 'a' < 1.1; select si from all1 where 'a' <= 1.1; select si from all1 where 'a' <> 1.1; select si from all1 where date('1996-09-09') = 'a';select si from all1 where date('1996-09-09') > 'a';select si from all1 where date('1996-09-09') >= 'a';select si from all1 where date('1996-09-09') < 'a';select si from all1 where date('1996-09-09') <= 'a';select si from all1 where date('1996-09-09') <> 'a';select si from all1 where 'a' = date('1996-09-09');select si from all1 where 'a' > date('1996-09-09');select si from all1 where 'a' >= date('1996-09-09');select si from all1 where 'a' < date('1996-09-09');select si from all1 where 'a' <= date('1996-09-09');select si from all1 where 'a' <> date('1996-09-09');select si from all1 where time('11:11:11') = 'a';select si from all1 where time('11:11:11') > 'a';select si from all1 where time('11:11:11') >= 'a';select si from all1 where time('11:11:11') < 'a';select si from all1 where time('11:11:11') <= 'a';select si from all1 where time('11:11:11') <> 'a';select si from all1 where 'a' = time('11:11:11');select si from all1 where 'a' > time('11:11:11');select si from all1 where 'a' >= time('11:11:11');select si from all1 where 'a' < time('11:11:11');select si from all1 where 'a' <= time('11:11:11');select si from all1 where 'a' <> time('11:11:11');select si from all1 where timestamp('1996-09-09 11:11:11.4' )= 'a';select si from all1 where timestamp('1996-09-09 11:11:11.4' )> 'a';select si from all1 where timestamp('1996-09-09 11:11:11.4' )>= 'a';select si from all1 where timestamp('1996-09-09 11:11:11.4' )< 'a';select si from all1 where timestamp('1996-09-09 11:11:11.4' )<= 'a';select si from all1 where timestamp('1996-09-09 11:11:11.4' )<> 'a';select si from all1 where 'a' = timestamp('1996-09-09 11:11:11.4');select si from all1 where 'a' > timestamp('1996-09-09 11:11:11.4');select si from all1 where 'a' >= timestamp('1996-09-09 11:11:11.4');select si from all1 where 'a' < timestamp('1996-09-09 11:11:11.4');select si from all1 where 'a' <= timestamp('1996-09-09 11:11:11.4');select si from all1 where 'a' <> timestamp('1996-09-09 11:11:11.4');-- create an all types tabledrop table all1;create table all1(si smallint, i int, li bigint, r real, dp double precision, dc decimal(5,1), num numeric(5,1), b char for bit data, bv varchar(1) for bit data, lbv long varchar for bit data, dt date, tm time, tms timestamp, c char(1), vc varchar(1), lvc long varchar);-- populate tableinsert into all1 values (2, 3, 4, 5.5, 6.6, 7.7, 8.8, X'20', X'20', X'20', date('1996-09-09'), time('12:12:12'), timestamp('1996-09-09 12:12:12.5'), '1', '2', '333333333333333333');-- tests for comparisons as qualifiersselect 1 from all1 where si = 'a';select 1 from all1 where si = '1.1';select 1 from all1 where si > 'a';select 1 from all1 where si > '1.1';select 1 from all1 where si >= 'a';select 1 from all1 where si >= '1.1';select 1 from all1 where si < 'a';select 1 from all1 where si < '1.1';select 1 from all1 where si <= 'a';select 1 from all1 where si <= '1.1';select 1 from all1 where si <> 'a';select 1 from all1 where si <> '1.1';select 1 from all1 where 'a' = si;select 1 from all1 where '1.1' = si;select 1 from all1 where 'a' > si;select 1 from all1 where '1.1' > si;select 1 from all1 where 'a' >= si;select 1 from all1 where '1.1' >= si;select 1 from all1 where 'a' < si;select 1 from all1 where '1.1' < si;select 1 from all1 where 'a' <= si;select 1 from all1 where '1.1' <= si;select 1 from all1 where 'a' <> si;select 1 from all1 where '1.1' <> si;select 1 from all1 where i = 'a';select 1 from all1 where i = '1.1';select 1 from all1 where i > 'a';select 1 from all1 where i > '1.1';select 1 from all1 where i >= 'a';select 1 from all1 where i >= '1.1';select 1 from all1 where i < 'a';select 1 from all1 where i < '1.1';select 1 from all1 where i <= 'a';select 1 from all1 where i <= '1.1';select 1 from all1 where i <> 'a';select 1 from all1 where i <> '1.1';select 1 from all1 where 'a' = i;select 1 from all1 where '1.1' = i;select 1 from all1 where 'a' > i;select 1 from all1 where '1.1' > i;select 1 from all1 where 'a' >= i;select 1 from all1 where '1.1' >= i;select 1 from all1 where 'a' < i;select 1 from all1 where '1.1' < i;select 1 from all1 where 'a' <= i;select 1 from all1 where '1.1' <= i;select 1 from all1 where 'a' <> i;select 1 from all1 where '1.1' <> i;select 1 from all1 where li = 'a';select 1 from all1 where li = '1.1';select 1 from all1 where li > 'a';select 1 from all1 where li > '1.1';select 1 from all1 where li >= 'a';select 1 from all1 where li >= '1.1';select 1 from all1 where li < 'a';select 1 from all1 where li < '1.1';select 1 from all1 where li <= 'a';select 1 from all1 where li <= '1.1';select 1 from all1 where li <> 'a';select 1 from all1 where li <> '1.1';select 1 from all1 where 'a' = li;select 1 from all1 where '1.1' = li;select 1 from all1 where 'a' > li;select 1 from all1 where '1.1' > li;select 1 from all1 where 'a' >= li;select 1 from all1 where '1.1' >= li;select 1 from all1 where 'a' < li;select 1 from all1 where '1.1' < li;select 1 from all1 where 'a' <= li;select 1 from all1 where '1.1' <= li;select 1 from all1 where 'a' <> li;select 1 from all1 where '1.1' <> li;select 1 from all1 where r = 'a';select 1 from all1 where r > 'a';select 1 from all1 where r >= 'a';select 1 from all1 where r < 'a';select 1 from all1 where r <= 'a';select 1 from all1 where r <> 'a';select 1 from all1 where 'a' = r;select 1 from all1 where 'a' > r;select 1 from all1 where 'a' >= r;select 1 from all1 where 'a' < r;select 1 from all1 where 'a' <= r;select 1 from all1 where 'a' <> r;select 1 from all1 where dp = 'a';select 1 from all1 where dp > 'a';select 1 from all1 where dp >= 'a';select 1 from all1 where dp < 'a';select 1 from all1 where dp <= 'a';select 1 from all1 where dp <> 'a';select 1 from all1 where 'a' = dp;select 1 from all1 where 'a' > dp;select 1 from all1 where 'a' >= dp;select 1 from all1 where 'a' < dp;select 1 from all1 where 'a' <= dp;select 1 from all1 where 'a' <> dp;select 1 from all1 where dc = 'a';select 1 from all1 where dc > 'a';select 1 from all1 where dc >= 'a';select 1 from all1 where dc < 'a';select 1 from all1 where dc <= 'a';select 1 from all1 where dc <> 'a';select 1 from all1 where 'a' = dc;select 1 from all1 where 'a' > dc;select 1 from all1 where 'a' >= dc;select 1 from all1 whe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -