# Tag: decimal

## Return decimal value in SQL query

Example of script ,sum(BREAKS)/3600 as Breaks but it comes back as a whole number, how can I get decimals?

## how to get number locate at 2 place before decimal point? [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 1 year ago. Improve this question example: i have a number=143.42 , i want to get “4” which is locate 2 place before decimal point. what SQL command should i use? i still

## 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 rounding is applied when casting, as

## 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 following:

## Decimal value gets rounded when entering DB

I’m trying to upload a decimal value into a database. Before the upload (while debugging C#) it’s decimal but when inserted to the database it’s the decimal is rounded so there aren’t any numbers …

## SQL round percent up to nearest .1

I have a columns of percentages and i want them to always round up to the nearest .1 for example .005 –> .1 .11 –> .2 .3256 –>.4 .6797 –>.7 I am trying ceiling and floor, but they …

## Issue converting JSON string into decimal

This question may answer on many threads but I am unable to find answer specific to my problem. Q: I am getting data from API (in json format) where all columns are coming as string and inserting …

## 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