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.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response