175k views
5 votes
For a field in Tom's database that holds dollar amounts, what is the most appropriate data type?

1) Integer
2) Float
3) String
4) Boolean

1 Answer

4 votes

Final answer:

The most appropriate data type for a field in a database holding dollar amounts is Float, as it allows for the precision needed in financial data.

Step-by-step explanation:

For a field in Tom's database that holds dollar amounts, the most appropriate data type would be Float. The Float data type is used to store numbers that have fractions or decimal points, which are common in monetary values. Using Float, you can accurately record both whole dollar amounts and cents, ensuring precise financial data representation. Using an Integer would only allow for whole numbers, which doesn't suit monetary values that typically include cents; a String would not allow for numerical calculations; and a Boolean would only hold true or false values, which is not relevant for quantities of money. Therefore, Float is the logical choice for storing dollar amounts in a database.

User Fuzzygroup
by
8.2k points