Solved

Show decimals with MySQL database

Posted on 2013-01-02
1
263 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 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

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://…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

740 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