FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


What is the difference between UNSIGNED and UNSIGNED ZEROFIL





pollux1er
I'm working on a database for a script I'm writing and I am wondering what is the difference between the UNSIGNED and UNSIGNED ZEROFILL attributes for column type?

Thanks in advance for any help.
rvec
unsigned means you can't go negative (0...n instead of -n...n). The sign is the leading bit specifying if a number is positive or negative. By having an unsigned number you'll have one more bit and thus double the possible numbers. So for a signed 3 bit number the first bit would be used for pos/neg and the other two for the actual number (-4...4) if it where unsigned you could count higher (0...Cool.

Zerofill means the number will be filled with zeroes from the left (00027 instead of 27 if the length is 5).
jmraker
According to http://kimbriggs.com/computers/computer-notes/mysql-notes/mysql-data-types-50.file
ZEROFILL will prepend zeros to a number as 000012 instead of just a normal 12. If the padded numbers are passed to a program, it would have to be as a string. I don't know if they are.
badai
it wouldn't be string. if you fetch 0000008 from db, the program will always treat it as 8, unless you explicitly fetch it as string in your sql.

jmraker wrote:
According to http://kimbriggs.com/computers/computer-notes/mysql-notes/mysql-data-types-50.file
ZEROFILL will prepend zeros to a number as 000012 instead of just a normal 12. If the padded numbers are passed to a program, it would have to be as a string. I don't know if they are.
Related topics
D difference between Anime and Tokusatsu... anyone know??
Difference between a Jr. Admin & MOD
Difference between watch & wife.
Is there a difference between "I know" and "I
Difference between Contests and Marketplace.
Whats the difference between Core Duo and Hyperthreading?
what is the difference between primary partition?
Diff: Windows 2000 Vs Windows server 2003
What is the Difference Between Love and Affection
What is the difference between these?
difference between windows xp service pack and sp 2 rc 1
difference between Pentium D, Pentium 4 and AMD Athlon
Difference between <div> and <p>...?
Actionscript2.0 - Difference between var :Object and new Obj
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.