SMALLINT[(M)] [UNSIGNED] [ZEROFILL] : SMALLINT : Data Types MySQL TUTORIALS


MySQL TUTORIALS » Data Types » SMALLINT »

 

SMALLINT[(M)] [UNSIGNED] [ZEROFILL]


A small integer.

The signed range is -32768 to 32767.

The unsigned range is 0 to 65535.

mysql>
mysql> CREATE TABLE myTable
    -> (
    ->    ID SMALLINT(4UNSIGNED ZEROFILL,
    ->    Quantity INT UNSIGNED
    -> );
Query OK, rows affected (0.05 sec)

mysql>
mysql> desc myTable;
+----------+-------------------------------+------+-----+---------+-------+
| Field    | Type                          | Null | Key | Default | Extra |
+----------+-------------------------------+------+-----+---------+-------+
| ID       | smallint(4unsigned zerofill | YES  |     | NULL    |       |
| Quantity | int(10unsigned              | YES  |     | NULL    |       |
+----------+-------------------------------+------+-----+---------+-------+
rows in set (0.02 sec)

mysql>
mysql> drop table myTable;
Query OK, rows affected (0.00 sec)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Data Types
» SMALLINT