Online Shopping : Computers : Databases : MySQL : Language and Syntax : Field Types : Tinyint

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

55 of 58 people (95%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

Why does tinyint show a size of 4 bytes in mysqlshow when it only needs 1 byte in the database?
What is the difference between a signed and an unsigned tinyint?

Feb 25th, 2000 16:40
Nathan Wallace, daveclark


I checked the doc , chapter 7 in both 3.22 (which I am using) and 3.23,
and between the two I determined that a tinyint requires 1 bytes in the
database and the 4 that mysqlshow is the number of characters that is
used for display.
I also learned that if you define the field as tinyint you get a signed
field with limits of -127 to +127 but if you defined it as tinyint
unsigned your limit is 0 to +255.
Amazing what you can find out when you rtfm!