Re: a very primitive question about division

From: Martin Mueller <martinmueller(at)northwestern(dot)edu>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: a very primitive question about division
Date: 2018-03-07 17:30:42
Message-ID: 1E4A383E-8468-450B-BB83-03BBBEF110B4@northwestern.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks. So round(before1550/colfreq::numeric, 2) produces the desired result.

The explanations and examples of string functions in the Postgres documentation are a model of clarity. The explanations and examples of basic arithmetic operations are not. There is room for improvement there.

From: "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Date: Wednesday, March 7, 2018 at 11:23 AM
To: Martin Mueller <martinmueller(at)northwestern(dot)edu>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: a very primitive question about division

On Wed, Mar 7, 2018 at 10:21 AM, Martin Mueller <martinmueller(at)northwestern(dot)edu<mailto:martinmueller(at)northwestern(dot)edu>> wrote:
Given two values defined as integers, how do I divide one by the other and get an answer with two decimals, e.g 3 /4 = 0.75.

​Case one of them to numeric.

​select 3/4::numeric

​David J.​

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2018-03-07 17:43:20 Re: a very primitive question about division
Previous Message David G. Johnston 2018-03-07 17:23:28 Re: a very primitive question about division