Skip to content
The Chat Archive
o3-2025-04-16· OpenAI LMArena Human Preference 140K

In mysql, what is a data type of decimal(15,2) ?

  1. User

    In mysql, what is a data type of decimal(15,2) ?

  2. Assistant

    DECIMAL(15,2) is MySQL’s fixed-point (exact) numeric type

    • Precision = 15 → total number of significant digits that can be stored
    • Scale = 2   → digits to the right of the decimal point

    What you can store
    – 13 digits before the decimal + 2 digits after it
    – Range: ‑9 999 999 999 999.99  to  9 999 999 999 999.99

    Why you’d use it
    Exact arithmetic with money, quantities, or anything where rounding errors from FLOAT/DOUBLE are unacceptable.

    Storage cost (internal)
    MySQL keeps DECIMAL values in a packed “binary-coded decimal” format.
    For DECIMAL(15,2) that’s 7 bytes:

    • 13 digits (left of decimal) → 9-digit group (4 B) + 4-digit group (2 B) = 6 B
    • 2 digits (right of decimal) → 1 B
    Total = 7 B

    In short: DECIMAL(15,2) is a fixed-point number with 15 total digits, exactly 2 of them after the decimal point—perfect for things like currency amounts (e.g., 1234567890.12).

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.