Re: a very primitive question about division - Mailing list pgsql-general

From Martin Mueller
Subject Re: a very primitive question about division
Date
Msg-id 1E4A383E-8468-450B-BB83-03BBBEF110B4@northwestern.edu
Whole thread Raw
In response to Re: a very primitive question about division  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: a very primitive question about division  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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.g.johnston@gmail.com>
Date: Wednesday, March 7, 2018 at 11:23 AM
To: Martin Mueller <martinmueller@northwestern.edu>
Cc: "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Subject: Re: a very primitive question about division

 

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.​

 

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: a very primitive question about division
Next
From: "David G. Johnston"
Date:
Subject: Re: a very primitive question about division