?
Solved

currency field in mysql

Posted on 2012-03-21
6
Medium Priority
?
378 Views
Last Modified: 2012-03-21
Can someone suggest what field is best to use and the best way to handle and store and create currencies fields. But there will be various currencies there (USD, JPY, etc.)

Also, is there some special way to handle GMT times?

Thanks!
0
Comment
Question by:onyourmark
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Assisted Solution

by:n4th4nr1ch
n4th4nr1ch earned 668 total points
ID: 37746063
0
 
LVL 10

Assisted Solution

by:Tobias
Tobias earned 664 total points
ID: 37746067
Dear,

The for money I suggest decimal, I don't know the precision of the decimal that you want. Most of the time two decimals it's ok.

For GMT times, I would use timestamp that it's in GMT too.

Regards
0
 

Author Comment

by:onyourmark
ID: 37746095
Would something like this work for price?

PriorOpen` decimal(45) NOT NULL DEFAULT ''

and how about for the GMT time:

`DateGMT` timestamp(45) NOT NULL DEFAULT '',
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:onyourmark
ID: 37746116
sorry, that did not make sense.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 668 total points
ID: 37747298
please make sure you don't mix up stuff.

30.3$  is 2 things, looking at it a normalized way:
* 30.3  amount, which is decimal
* $     currency, which can be stored in a dedicated field with either
    - USD  : it's iso code (recommended)
    - $  :  it's visual representation
    - xxx: some other lookup key value, for example a numerical key which is the fk for another table that stores the currencies used

if you stored litterally '30.3$' in a string/text field, you will end up with nothing but problems when you need to do SUM( ) or similar math stuff with the amount, or currency conversion(s) to other currencies.
0
 

Author Closing Comment

by:onyourmark
ID: 37750322
Thanks all.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question