Difficulty: Easy
Correct Answer: Data type
Explanation:
Introduction / Context:
When creating tables, one of the most important choices is the column's data type. For money-like values (such as prices, totals, taxes, and discounts), the data type determines how values are stored, their precision, and how arithmetic behaves. Choosing the right property avoids rounding errors and guarantees that each value is treated as numeric currency rather than as free text.
Given Data / Assumptions:
Concept / Approach:
The data type is the column property that enforces what kind of data can be stored. For currency, fixed-point numeric types (for example, DECIMAL(p,s) or NUMERIC(p,s)) are preferred because they support exact arithmetic with a defined precision (p) and scale (s). Other properties (NULL status, default values, constraints) refine behavior, but the foundational guarantee that a column holds monetary numbers comes from the data type.
Step-by-Step Solution:
Verification / Alternative check:
Insert typical values (for example, 199.99, 0.05, 9999999.99) and perform arithmetic. Confirm that results are exact under DECIMAL/NUMERIC and that the DBMS prevents non-numeric input.
Why Other Options Are Wrong:
Common Pitfalls:
Using floating-point types (REAL/DOUBLE) for money can introduce rounding errors. Always choose fixed-point NUMERIC/DECIMAL for financial calculations.
Final Answer:
Data type
Discussion & Comments