juniorMySQL
FLOAT vs DECIMAL types
Updated May 4, 2026
Short answer
FLOAT is approximate; DECIMAL is exact.
Deep explanation
FLOAT uses floating-point math which can have rounding errors. DECIMAL stores values exactly, making it mandatory for financial data.
Real-world example
Using DECIMAL for currency and FLOAT for scientific measurements like temperature.
Common mistakes
- Using FLOAT for money, which causes precision loss over time.
Follow-up questions
- What does DECIMAL(5,2) mean?