Examveda

The datatype best suited to store currency values is . . . . . . . .

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 (currency) in a MySQL database.
Here's why the answer is DECIMAL:
* INT (Integer): Stores whole numbers only. Not good for money because it can't represent cents or fractions.
* FLOAT (Floating Point): Stores numbers with decimals, but it's not precise enough for currency. Small errors can accumulate, leading to incorrect calculations.
* DOUBLE (Double Precision Float): Similar to FLOAT, but with more decimal places. Still not ideal for accurate financial calculations.
* DECIMAL: The best choice for currency! It stores numbers with a fixed number of decimal places, ensuring precise calculations for money.
Therefore, the correct answer is D: DECIMAL**.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous