Solved

Show decimals with MySQL database

Posted on 2013-01-02
1
253 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
ID: 38736708
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

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.

Question has a verified solution.

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

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Creating and Managing Databases with phpMyAdmin in cPanel.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
A short film showing how OnPage and Connectwise integration works.

919 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

19 Experts available now in Live!

Get 1:1 Help Now