ExamVeda
Login
Home
This question belongs to MySQL MySQL Miscellaneous
MySQL Miscellaneous
?

Which data type is best suited to store currency values?

Answer & Solution
Correct Answer: Option D
This question asks about the best way to store money in a MySQL database. Let's break down the options:
Option A: INT
INT is for whole numbers. It wouldn't be good for storing money because money often has cents (like $10.50).
Option B: FLOAT
FLOAT is used for numbers with decimals. But it can have problems with precision. This means that sometimes tiny fractions of a cent might be lost, which is bad for financial calculations.
Option C: DOUBLE
DOUBLE is similar to FLOAT, but it can store even bigger and more precise numbers. Still, it might not be ideal for financial data.
Option D: DECIMAL
DECIMAL is the best option for storing money! It's specifically designed for storing numbers with a fixed number of decimal places, so you can be sure that every cent is accounted for.
So the answer is Option D: DECIMAL
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.