⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 float.sql

📁 关系型数据库 Postgresql 6.5.2
💻 SQL
字号:
------------------------------------------------------------------------------- float.sql---    test float4, float8 adt------ Copyright (c) 1994-5, Regents of the University of California---- $Id: float.sql,v 1.1.1.1 1996/07/09 06:22:30 scrappy Exp $--------------------------------------------------------------------------------- float4--create table fl (x float4);insert into fl values ( 3.14 );insert into fl values ( 147.0 );insert into fl values ( 3.14 );insert into fl values ( -3.14 );select * from fl;-- float literalsselect * from fl where x = 3.14;select * from fl where x <> 3.14;select * from fl where x < 3.14;select * from fl where x <= 3.14;select * from fl where x > 3.14;select * from fl where x >= 3.14;-- adt constant without cast (test coercion)select * from fl where x = '3.14';select * from fl where x <> '3.14';select * from fl where x < '3.14';select * from fl where x <= '3.14';select * from fl where x > '3.14';select * from fl where x >= '3.14';-- adt constant with float4 cast (test float4 opers)select * from fl where x = '3.14'::float4;select * from fl where x <> '3.14'::float4;select * from fl where x < '3.14'::float4;select * from fl where x <= '3.14'::float4;select * from fl where x > '3.14'::float4;select * from fl where x >= '3.14'::float4;-- adt constant with float8 cast (test float48 opers)select * from fl where x = '3.14'::float8;select * from fl where x <> '3.14'::float8;select * from fl where x < '3.14'::float8;select * from fl where x <= '3.14'::float8;select * from fl where x > '3.14'::float8;select * from fl where x >= '3.14'::float8;-- try other operatorsupdate fl set x = x + 2.2;select * from fl;update fl set x = x - 2.2;select * from fl;update fl set x = x * 2.2;select * from fl;update fl set x = x / 2.2;select * from fl;---- float8--create table fl8 (y float8);insert into fl8 values ( '3.14'::float8 );insert into fl8 values ( '147.0'::float8 );insert into fl8 values ( '3.140000001'::float8 );insert into fl8 values ( '-3.14'::float8);select * from fl8;-- float literalsselect * from fl8 where y = 3.14;select * from fl8 where y <> 3.14;select * from fl8 where y < 3.14;select * from fl8 where y <= 3.14;select * from fl8 where y > 3.14;select * from fl8 where y >= 3.14;-- adt constant without cast (test coercion)select * from fl8 where y = '3.14';select * from fl8 where y <> '3.14';select * from fl8 where y < '3.14';select * from fl8 where y <= '3.14';select * from fl8 where y > '3.14';select * from fl8 where y >= '3.14';-- adt constant with float4 cast (test float84 opers)select * from fl8 where y = '3.14'::float4;select * from fl8 where y <> '3.14'::float4;select * from fl8 where y < '3.14'::float4;select * from fl8 where y <= '3.14'::float4;select * from fl8 where y > '3.14'::float4;select * from fl8 where y >= '3.14'::float4;-- adt constant with float8 cast (test float8 opers)select * from fl8 where y = '3.14'::float8;select * from fl8 where y <> '3.14'::float8;select * from fl8 where y < '3.14'::float8;select * from fl8 where y <= '3.14'::float8;select * from fl8 where y > '3.14'::float8;select * from fl8 where y >= '3.14'::float8;-- try other operatorsupdate fl8 set y = y + '2.2'::float8;select * from fl8;update fl8 set y = y - '2.2'::float8;select * from fl8;update fl8 set y = y * '2.2'::float8;select * from fl8;update fl8 set y = y / '2.2'::float8;select * from fl8;-- drop tablesdrop table fl;drop table fl8;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -