Which data type is best suited to store currency values?
A. INT
B. FLOAT
C. DOUBLE
D. DECIMAL
Answer: Option D
Solution (By Examveda Team)
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
Related Questions on MySQL Miscellaneous
How is communication established with MySQL?
A. SQL
B. Network calls
C. A programming language like C++
D. APIs
Which type of database management system is MySQL?
A. Object-oriented
B. Hierarchical
C. Relational
D. Network
Join The Discussion