1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
1
You can use the CAST
function in combination with division. Since functions in Athena engine version 3 are based on Trino, it supports casting data types.
💡 When querying the data, you can cast the integer values to a decimal type and divide by
100
to get the correct monetary value with three decimal places.
SELECT id, CAST(amount AS DECIMAL(18, 3)) / 100.0 AS formatted_amount FROM your_table;
In this query, amount
is the column containing the integer monetary values. By casting it to DECIMAL(18, 3)
, you're specifying a decimal type with 18
digits of precision and 3
decimal places. Dividing by 100.0
converts the integer values to their correct decimal representation (e.g., 1000
becomes 10.000
).
Key Sources:
관련 콘텐츠
- AWS 공식업데이트됨 일 년 전
Is there any functionality that it can be done in DDL i mean while table creation?
I have 60 column and more than 30 column are in this format so i want that it should be handle while creating the table like i specified at that time no of decimal in the integer