SnowPro Associate: Platform Question 116
Single answer● Data typesA retail company is loading sales data from CSV files into a Snowflake table. One source column, ORDER_TOTAL, contains values such as 125.50, 0.99, and 10234.10. Finance users run reports that must preserve exact values with no rounding surprises, and analysts do not need to perform currency conversion within this column. Which Snowflake data type is the most appropriate for ORDER_TOTAL?
- A
FLOAT
- B
VARCHAR
- C
NUMBER(10,2)
- D
BOOLEAN
Show answer and explanation
Correct answer: C
Explanation
For currency and other exact decimal values, Snowflake best practice is to use a fixed-point numeric type such as NUMBER, DECIMAL, or NUMERIC, which are synonymous in Snowflake. In this scenario, NUMBER(10,2) is the best fit because it preserves exact values to two decimal places, which is critical for financial reporting. FLOAT is intended for approximate numeric storage and can produce small precision differences that are unacceptable for finance use cases. VARCHAR may seem flexible during ingestion, but it shifts type enforcement and conversion to query time, increasing complexity and potential errors. According to Snowflake documentation, fixed-point types are appropriate when exact precision is required, while floating-point types are approximate and better suited to scientific or statistical use cases.
- A. Incorrect.
FLOAT is incorrect. Although it can store decimal-looking values, FLOAT is an approximate numeric type and can introduce representation differences because it uses floating-point semantics. This makes it a poor choice for financial amounts where exact precision is required.
- B. Incorrect.
VARCHAR is incorrect. Storing ORDER_TOTAL as text preserves the original characters, but it prevents efficient numeric validation and arithmetic unless values are repeatedly cast during queries. This approach increases the risk of data quality issues and is not a best practice for monetary amounts.
- C. Correct.
NUMBER(10,2) is correct. NUMBER is Snowflake's exact fixed-point numeric type, and a scale of 2 is appropriate for currency values stored to two decimal places. This supports accurate aggregation, filtering, and reporting without floating-point precision issues.
- D. Incorrect.
BOOLEAN is incorrect. BOOLEAN is designed for true/false values and cannot appropriately represent monetary amounts such as 125.50 or 10234.10.