So I’m asked to do this query for a college project: SELECT l.city AS name, AVG((pr.ap_price::double precision * 7 – pr.weekly::double precision) …
Tag: casting
One large DB request plus many Casts vs. many single DB requests – which is faster for a lot of Data [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question let’s say you have 5 concrete classes implementing the interface IResult. And you want to work with many diffrent concrete objects
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
avoid explicit cast to float?
Can SELECT CAST(2.083 AS float) AS c be written in a more compact way ? Something like SELECT 2.083f AS c ?
Cannot figure out the issue with this SQL CASE
The issue i am facing is: “SYNTAX_ERROR: line 7:6: All CASE results must be the same type: boolean” I have also joined the table in a previous sub query casting it as a varchar, so there shouldn’t be any issues with this. Anyone have any ideas? For context i am trying to populate a field that would return a blank
Changing data type to float and rounding to 2 decimal digits
Tables: Goal: Display each unique job, the total average salary (FLOAT and rounded to 2 decimal places), the total people and the total salary (Float and rounded to 2 decimal places) and order by highest average salary. So the challenge is to keep the cast type as float while rounding it to 2 decimal places. I’ve gotten to where I’ve
Casting the Bigint number Returns NULL
I need o convert a integer value to the highest data type in hive as my value is of 25 digits NULL value will be returned for the above select stmnt; I am very well aware that the supplied number is greater than the largest number of Bigint. But we are getting such values upon which i have to calculate
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 …
Convert INT to DATETIME (SQL)
I am trying to convert a date to datetime but am getting errors. The datatype I’m converting from is (float,null) and I’d like to convert it to DATETIME. The first line of this code works fine, but I get this error on the second line: Arithmetic overflow error converting expression to data type datetime. Answer you need to convert to