While designing a star-schema fact table that records each sales transaction's total amount in U.S. dollars down to the cent, you must guarantee exact precision for all arithmetic operations and avoid rounding anomalies during aggregation. Which ANSI-SQL numeric data type is the most appropriate choice for the column?
DECIMAL (also called NUMERIC) is a fixed-point, exact numeric data type. Its precision (total digits) and scale (digits after the decimal point) are defined by the developer, so values are stored exactly as written. Database vendors-including MySQL and SQL Server-explicitly recommend DECIMAL/NUMERIC for monetary or other calculations that cannot tolerate rounding error. FLOAT and DOUBLE PRECISION are approximate binary floating-point types; they represent many decimal fractions only approximately and can introduce subtle errors when summed or multiplied. INTEGER stores only whole numbers, so it cannot represent cents. Therefore, DECIMAL(p,s) is the only option that meets the requirement for exact two-decimal-place currency values.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What do precision and scale mean in DECIMAL(p,s)?
Open an interactive chat with Bash
Why are FLOAT and DOUBLE PRECISION not suitable for currency calculations?
Open an interactive chat with Bash
How does the DECIMAL data type avoid rounding anomalies in calculations?
Open an interactive chat with Bash
CompTIA Data+ DA0-002 (V2)
Data Concepts and Environments
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .