944,006 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 55995
  • MySQL RSS
Jan 23rd, 2006
0

use of mysql unsigned ?

Expand Post »
IWhat exactly is the "unsigned" use for in sql and when should i consider using it?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nike123 is offline Offline
20 posts
since Jun 2005
Mar 8th, 2006
0

Re: use of mysql unsigned ?

The best I can gather from the documentation is that "signed" or "unsigned" refers to the plus or minus sign a person would traditionally use to indicate a positive or negative value. So an UNSIGNED numeric value can never be negative.

Therefore, if you have a column that you want to contain a numeric value, but never hold a negative value, I guess you could apply the UNSIGNED modifier to the data type.

http://dev.mysql.com/doc/refman/5.0/...-overview.html
Reputation Points: 36
Solved Threads: 6
Posting Whiz
Troy is offline Offline
354 posts
since Jun 2005
Apr 15th, 2006
0

Re: use of mysql unsigned ?

the biggest difference is an unsigned number cannot be negative (just as stated above)

but the benefit of usign an unsigned number is that you can have a greater range of positive numbers.

Tinyint: The signed range is -128 to 127. The unsigned range is 0 to 255.
Mediumint: The signed range is -8388608 to 8388607. The unsigned range is 0 to 16777215.
Bigint: The signed range is -9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615.

you get the point from there, a great use of unsigned numbers is for any column that has an auto_increment flag on it, since it will never be negative
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: Search facility for a drop down box
Next Thread in MySQL Forum Timeline: project stuff





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC