当前位置: 首页 > news >正文

新网站怎么做网络推广潮州网站建设

新网站怎么做网络推广,潮州网站建设,天鸿建设集团有限公司 网站,网站 什么语言开发的背景 整型除以整型,正常情况下当然得到的应该也是整型。数据库也是这么干的。 但是在数据库应用中,通常业务的需求是得到NUMERIC,不能直接把小数干掉。 数据库的行为给用户带来了诸多不便,例如1除以2,如果是整型除法会…

背景

整型除以整型,正常情况下当然得到的应该也是整型。数据库也是这么干的。

但是在数据库应用中,通常业务的需求是得到NUMERIC,不能直接把小数干掉。

数据库的行为给用户带来了诸多不便,例如1除以2,如果是整型除法会得到0,然而用户可能要的是0.5。

那么怎么处理呢?

1、建议用户使用float8, money, numeric来存储这种数值。

2、或者在除法时,对操作数进行转换。

操作符

postgres=# \do+ /  List of operators  Schema   | Name |  Left arg type   |  Right arg type  |   Result type    |   Function    |         Description            
------------+------+------------------+------------------+------------------+---------------+------------------------------  pg_catalog | /    | bigint           | bigint           | bigint           | int8div       | divide  pg_catalog | /    | bigint           | integer          | bigint           | int84div      | divide  pg_catalog | /    | bigint           | smallint         | bigint           | int82div      | divide  pg_catalog | /    | box              | point            | box              | box_div       | divide box by point (scale)  pg_catalog | /    | circle           | point            | circle           | circle_div_pt | divide  pg_catalog | /    | double precision | double precision | double precision | float8div     | divide  pg_catalog | /    | double precision | real             | double precision | float84div    | divide  pg_catalog | /    | integer          | bigint           | bigint           | int48div      | divide  pg_catalog | /    | integer          | integer          | integer          | int4div       | divide  pg_catalog | /    | integer          | smallint         | integer          | int42div      | divide  pg_catalog | /    | interval         | double precision | interval         | interval_div  | divide  pg_catalog | /    | money            | bigint           | money            | cash_div_int8 | divide  pg_catalog | /    | money            | double precision | money            | cash_div_flt8 | divide  pg_catalog | /    | money            | integer          | money            | cash_div_int4 | divide  pg_catalog | /    | money            | money            | double precision | cash_div_cash | divide  pg_catalog | /    | money            | real             | money            | cash_div_flt4 | divide  pg_catalog | /    | money            | smallint         | money            | cash_div_int2 | divide  pg_catalog | /    | numeric          | numeric          | numeric          | numeric_div   | divide  pg_catalog | /    | path             | point            | path             | path_div_pt   | divide (rotate/scale path)  pg_catalog | /    | point            | point            | point            | point_div     | divide points (scale/rotate)  pg_catalog | /    | real             | double precision | double precision | float48div    | divide  pg_catalog | /    | real             | real             | real             | float4div     | divide  pg_catalog | /    | smallint         | bigint           | bigint           | int28div      | divide  pg_catalog | /    | smallint         | integer          | integer          | int24div      | divide  pg_catalog | /    | smallint         | smallint         | smallint         | int2div       | divide  
(25 rows)  

显示转换

int 转成 numeric或者float8后再除。

例子

postgres=# select 1/2;  ?column?   
----------  0  
(1 row)  
显示转换任意操作数postgres=# select 1/2.0;  ?column?   
----------  0.5  
(1 row)  postgres=# select 1/2::float8;  ?column?   
----------  0.5  
(1 row)  postgres=# select 1/2::numeric;  ?column?          
------------------------  0.50000000000000000000  
(1 row)  

本篇文章如有帮助到您,请给「翎野君」点个赞,感谢您的支持。

首发链接: https://www.cnblogs.com/lingyejun/p/17678380.html

http://www.ds6.com.cn/news/40800.html

相关文章:

  • directory wordpress下载优化大师并安装
  • 黄冈网站建设流程百度一下下载安装
  • 企业做网站推广产品需要多少钱丹东网站seo
  • 内蒙做网站seo引擎优化怎么做
  • 外贸网站怎样做网络推广培训课程内容
  • 网站首眉怎么做深圳网络推广培训学校
  • 做最好的导航网站做网站的公司哪家最好
  • 邵阳属于哪个省哪个市搜索引擎优化怎么做
  • 交通信息华建设网站在线代理浏览网站免费
  • 免费网站推广网址南京seo推广优化
  • eclipse开发动态网站开发seo优化器
  • 聊城高端网站建设报价广州seo网站排名
  • 做网站推广有啥活动网站关键词优化推广哪家好
  • 专业的高密做网站的含有友情链接的网页
  • 网站优化靠谱seo百度推广外推联系方式
  • 常州市做网站想做网络推广的公司
  • 重庆做网站建设公司哪家好中国十大网站有哪些
  • 这几年做哪个网站能致富优质外链
  • ui展示 网站seo网站优化服务商
  • 坪山网站建设哪家便宜佛山营销型网站建设公司
  • 搭建一个个人网站网络营销经典失败案例
  • 两个网站做的h5如何合在一起广告推广策划
  • 昆山市做网站全球搜索引擎市场份额
  • 网页游戏不花钱的seo关键词优化软件
  • 网站怎么做数据分析搜狗站长管理平台
  • 徐州网站制作报价百度搜题在线使用
  • 做网站交接需要哪些权限seo应该如何做
  • 建筑人才招聘网站平台郑州网站推广电话
  • 怎么找网站帮我做推广百度推广电话号码
  • 手机端网站排名石家庄seo培训