Skip to content

Tag: decimal

Redshift casting decimal to decimal

Why does casting a decimal to decimal lose all decimals? For example, Returns 2 Answer A decimal number has a precision (the total number of significant digits in the whole number) and a scale (the number of decimal digits). In Redshift, the default precision is 18, but the default scale is 0, and automatic r…

Want decimal result Amazon Redshift

I am trying to calculate the average ice creams a kid will have during summer. I want the result to have 2 decimals. Query: The result I get is something like 1.0003. I only want 2 decimal points. Any suggestions? Answer You can do this with round

Dividing by decimal values – rounding issue

I’m trying to divide two decimal values, in hope they will return the following; 1.132930. However, SQL appears to be rounding the value to 1.132931. The value returned before conversion is 1.1329305135951. The SQL code i’m using is as follows: Answer You can round the value before the cast as fol…

how to show decimals in sql instead of 0

I am trying to get the percent and it just shows up as zero. I want to show two decimal places such as 0.65 Here is a piece of the query I am selecting: if I use this it shows up as 0 and gets rid of the rest Answer Meanwhile, I question whether COUNT(numbers) is what you want. That

set decimal places of sum in sql

I have a database I use for a debating competition I am trying to sort the standings out to see which schools will play off in the finals at the end of the semester. I have this working as shown below however I am not able to round the ptc field, it currently returns up to 4 decimal places eg