Solved

Show decimals with MySQL database

Posted on 2013-01-02
1
251 Views
Last Modified: 2013-01-07
I currently have a price field set up as INT (11).

This price field was to show annual salaries  ie 35,000, 25,000 etc but now I need to include hourly rates such as 6.19. If you 6.19 at the moment it just shows as 6.

So I now need to show decimal values can this be done keeping the INT format? or do I need to change the structure?

db
0
Comment
Question by:BrighteyesDesign
1 Comment
 
LVL 22

Accepted Solution

by:
Steve Wales earned 500 total points
Comment Utility
Integer data types are for whole numbers only.

If you need decimal values, you'll need to modify your structure to a data type that supports decimal values (I believe that's DECIMAL in mySQL, but it might be FLOAT, check the documentation)

EDIT: Here's the documentation links for MySQL Fixed/Floating Point numeric values:

http://dev.mysql.com/doc/refman/5.0/en//numeric-types.html#integer-types
http://dev.mysql.com/doc/refman/5.0/en//fixed-point-types.html
http://dev.mysql.com/doc/refman/5.0/en//floating-point-types.html
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
This video discusses moving either the default database or any database to a new volume.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now