What is the best data type for int values like 5.2 or 3.5?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

What is the best data type for int values like 5.2 or 3.5?

Post by Citizen »

What is the best data type for stuff like 5.2 or 3.5? I know that INT truncates all decimal values.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

FLOAT, DOUBLE, DECIMAL or variables thereof....
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

Post by Citizen »

Is there a difference between them?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That is something you can research quite easily. ;)
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

Post by Citizen »

Well, I looked up them before asking the question to begin with :)

The kinds of things the manual wont tell me is if there's a performance difference or if one is better than the other for a task that all three can do :)
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

What are you planning on using it for?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

Citizen wrote:Well, I looked up them before asking the question to begin with :)

The kinds of things the manual wont tell me is if there's a performance difference or if one is better than the other for a task that all three can do :)
On the contrary, the manual is THE place to get detailed and precise answers to questions like yours. http://dev.mysql.com/doc/refman/4.1/en/ ... rview.html explains the differences quite clearly.
Post Reply