Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9170955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:05:52+00:00 2026-06-17T16:05:52+00:00

Am building a application that’ll allow users to enter values in different currency formats.

  • 0

Am building a application that’ll allow users to enter values in different currency formats.

My initial idea was to save the data in the following format.

  • amount – string
  • currency – string with ISO 4217 currency code e.g. GBP, USD, RUB

Is this design a good idea or should I use for the amount field, integer, decimal or float type?

Am unsure how the different styles of formatting will affect the storage.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:05:52+00:00Added an answer on June 17, 2026 at 4:05 pm

    My vote would be for:

    • Amount – DECIMAL(18,4) -> you can of course change the size depending on what you need. I don’t know my currencies well enough to tell you how many decimal places you need so I decided to go with 4. I know at least up to 3 exists (see Various country's "currency decimal places width" in the iPhone-SDK)
    • Currency – foreign key reference to a currency table

    Why the FK reference and currency table? You can then store more information along with each currency (e.g. relevant culture or formatting info), as well as have an additional table with exchange rates if necessary, so you can add everything up into one base currency.

    Besides, storage is cheap these days.


    Note:

    • I would not go with a string for the amount, for the simple fact that you can’t add them and you can’t order by them (easily). You also lose the built-in validation that the amount is indeed a number.

    • I would also not go with a float for the amount because monetary amounts are supposed to be exact. You don’t want to have to round every result to display it; what if you’re off by a cent in the wrong direction?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building an application that will have two different types of users, lets call
I am building an application that will allow users to sign in using their
Background: We're building an application that allows our customers to supply data in a
I'm building an application that uses an elaborate API to fetch data from Youtube,
I'm building an application that is used by several different customers. Each customer has
I'm building an application that needs to allow a user to insert text from
I'm building a application that supports different domains. A small CMS that supports different
I'm building application that needs to send recorded audio and video data to net
Im building an application that requires extensive logging of actions of the users, payments,
I'm building an application that gives users the option to send out an email

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.