jordanwb Posted June 12, 2008 Share Posted June 12, 2008 Where does the three come in? For example in phpmyadmin, if I create a field with an unsigned TinyInt, its length defaults to three. Unsigned TinyInt goes from 0-255. Any number in that range takes up 8 bits. So where does the Length come into play? Quote Link to comment Share on other sites More sharing options...
Barand Posted June 12, 2008 Share Posted June 12, 2008 255 is three digits Quote Link to comment Share on other sites More sharing options...
jordanwb Posted June 12, 2008 Author Share Posted June 12, 2008 Yeah but if I put in 256 (which requires 9 bits), I get this warning: Warning: #1264 Out of range value adjusted for column 'fgn' at row 1 and goes down to 255 Quote Link to comment Share on other sites More sharing options...
Barand Posted June 12, 2008 Share Posted June 12, 2008 As you stated, max value for unsigned tinyint is 255. http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html Quote Link to comment Share on other sites More sharing options...
jordanwb Posted June 12, 2008 Author Share Posted June 12, 2008 Yes but where does the 3 come in? Quote Link to comment Share on other sites More sharing options...
Barand Posted June 12, 2008 Share Posted June 12, 2008 255 is three digits If you don't believe me, count them yourself 2...5...5 Quote Link to comment Share on other sites More sharing options...
jordanwb Posted June 12, 2008 Author Share Posted June 12, 2008 So an unsigned TinyInt3 means that the maximum value is any value that can fit into 8 bits and is at most 3 digits long. Quote Link to comment Share on other sites More sharing options...
fenway Posted June 13, 2008 Share Posted June 13, 2008 So an unsigned TinyInt3 means that the maximum value is any value that can fit into 8 bits and is at most 3 digits long. Ignore the 3, it's meaningless. it's dispaly width. Quote Link to comment Share on other sites More sharing options...
jordanwb Posted June 13, 2008 Author Share Posted June 13, 2008 Ok. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.