beginnerSQL Fundamentals Deep Dive — Data Types, NULL Handling & Query Execution Order
Why should monetary values always be stored as NUMERIC rather than REAL or FLOAT?
NUMERIC stores digits directly in an exact, arbitrary-precision base-10 representation. REAL/DOUBLE PRECISION store values in IEEE 754 binary floating point, which cannot represent most decimal fractions exactly — 0.10 is actually stored as a close binary approximation. For money, these tiny, silent rounding errors compound across enough transactions into a real, visible discrepancy.
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
Why should monetary values always be stored as NUMERIC rather than REAL or FLOAT?