SQL - 类型转换

类型转换

SELECT numeric '10' / numeric '3' AS col_1;                    -- PG语法
SELECT '10'::numeric/'3'::numeric AS col_1;                    -- PG语法
SELECT CURRENT_DATE::varchar(20);                              -- PG语法

select cast('10' as numeric) / cast ('3' as numeric) as col_1; -- 标准的SQL语法

-- cast 函数
select substring(cast('12345' as text), 3, 1);
posted @ 2019-11-30 12:23  duchaoqun  阅读(128)  评论(0编辑  收藏  举报