MySQL Tutorial/Data Types/TINYINT
Insert value to TINYINT column
mysql>
mysql> CREATE TABLE myTable(
-> ID TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> Name VARCHAR(50) NOT NULL
-> );
Query OK, 0 rows affected (0.05 sec)
mysql>
mysql>
mysql> INSERT INTO myTable (ID, Name)VALUES (1, "Ain\"t ");
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> select * from myTable;
+----+--------+
| ID | Name |
+----+--------+
| 1 | Ain"t |
+----+--------+
1 row in set (0.00 sec)
mysql>
mysql> drop table myTable;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
TINYINT[(M)] [UNSIGNED] [ZEROFILL]
A very small integer.
The signed range is -128 to 127.
The unsigned range is 0 to 255.
mysql>
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>
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>
mysql>
mysql>