use of mysql unsigned ?

Reply

Join Date: Jun 2005
Posts: 20
Reputation: nike123 is an unknown quantity at this point 
Solved Threads: 0
nike123 nike123 is offline Offline
Newbie Poster

use of mysql unsigned ?

 
0
  #1
Jan 23rd, 2006
IWhat exactly is the "unsigned" use for in sql and when should i consider using it?
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 354
Reputation: Troy is an unknown quantity at this point 
Solved Threads: 5
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: use of mysql unsigned ?

 
0
  #2
Mar 8th, 2006
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
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Re: use of mysql unsigned ?

 
0
  #3
Apr 15th, 2006
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC