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

日照网站建设不全百度热搜榜单

日照网站建设不全,百度热搜榜单,IT男做网站,网站后台配置背景 整型除以整型,正常情况下当然得到的应该也是整型。数据库也是这么干的。 但是在数据库应用中,通常业务的需求是得到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.hengruixuexiao.com/news/30008.html

相关文章:

  • 哪些网站平台可以做推广seo分析是什么意思
  • 青岛市城市建设档案馆网站搜索引擎优化规则
  • 猪八戒网做网站怎么样bt磁力库
  • 网龙公司有做网站吗打造龙头建设示范
  • 网站建设的扁平化设计国外外链平台
  • 有做装修效果图赚钱的网站吗成都seo网络优化公司
  • 不懂代码可以做网站吗新品上市怎么做宣传推广
  • 河北省住房和建设厅网站首页百度搜题在线使用
  • 怎样做省钱购物网站点击软件
  • 自己做网站的软件下载淘宝运营培训班去哪里学
  • 网站开发上门服务费北京优化seo排名优化
  • 17zwd一起做网站株洲站广告seo是什么意思
  • 网站设计的一般步骤是什么?安徽seo人员
  • 网站建设公司运营模式抖音推广怎么做
  • 网站开发规范文档如何做网站推广优化
  • 企业服务器搭建方案seo推广公司
  • 武汉ui设计公司seo关键词优化推广价格
  • 黑龙江建设网网站软文代发
  • 商城类网站建设步骤成都网站优化平台
  • 网站用户登录流程图收录网
  • 上海做网站那家公司好百度扫一扫
  • 网站设计 做鼠标效果必应站长平台
  • 站长源码之家长春百度推广公司
  • 河北建设网网站短链接在线生成器
  • 门户网站建设存在问题与不足留号码的广告网站
  • 网站前期准备网络营销策划书8000字
  • 福州网站建设站长工具官网查询
  • 企业服务 免费网站建设html网页制作模板代码
  • 不会代码怎么做网站营销与销售的区别
  • 青海企业网站建设关键词排名优化软件价格