milanello72 Posted January 13, 2013 Share Posted January 13, 2013 1. What is tinyint(4)? 2. Is 4 the number of digits? 3. Could you tell me the diference between tinyint(4) and tinyint(3)? 4. Is it possible to have tinyint(7) ? Thank u very much! Link to comment https://forums.phpfreaks.com/topic/273095-the-diference-between-tinyint4-and-tinyint3/ Share on other sites More sharing options...
Barand Posted January 13, 2013 Share Posted January 13, 2013 tinyint is 1 byte, so signed has a max of 127 and unsigned a max of 255. Therefore greater than tinyint(3) isn't much use. Link to comment https://forums.phpfreaks.com/topic/273095-the-diference-between-tinyint4-and-tinyint3/#findComment-1405346 Share on other sites More sharing options...
kicken Posted January 13, 2013 Share Posted January 13, 2013 For integer types (tinyint, smallint, int, etc) the number in parenthesis is the display width that is used when the column is created with the ZEROFILL property. If the number stored is less than the display width, it is zero-padded up to that width. Eg: For example, a SMALLINT(4) ZEROFILL would return the number 125 as '0125' in SELECT queries. The number 12050 however would still be returned as '12050'. It is already larger than the display width so no padding is done. Link to comment https://forums.phpfreaks.com/topic/273095-the-diference-between-tinyint4-and-tinyint3/#findComment-1405357 Share on other sites More sharing options...
fenway Posted January 13, 2013 Share Posted January 13, 2013 That display width is pretty much useless -- and definitely meaningless without ZEROFILL -- which no one should use anyway. Link to comment https://forums.phpfreaks.com/topic/273095-the-diference-between-tinyint4-and-tinyint3/#findComment-1405390 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.