?
Solved

Show decimals with MySQL database

Posted on 2013-01-02
1
Medium Priority
?
265 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
[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
1 Comment
 
LVL 22

Accepted Solution

by:
Steve Wales earned 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this article, we’ll look at how to deploy ProxySQL.
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