Mega Code Archive

 
Categories / MySQL Tutorial / Data Types
 

TINYINT[(M)] [UNSIGNED] [ZEROFILL]

A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255. mysql> mysql> CREATE TABLE myTable(     ->    ID TINYINT UNSIGNED NOT NULL DEFAULT 1,     ->    Name VARCHAR(50) NOT NULL     -> ); Query OK, 0 rows affected (0.03 sec) mysql> mysql> INSERT INTO myTable (Name)VALUES ('A'); Query OK, 1 row affected (0.00 sec) mysql> mysql> select * from myTable; +----+------+ | ID | Name | +----+------+ |  1 | A    | +----+------+ 1 row in set (0.00 sec) mysql> mysql> drop table myTable; Query OK, 0 rows affected (0.00 sec) mysql>