Auto_INCREMENT primary key : PRIMARY KEY : Table MySQL TUTORIALS


MySQL TUTORIALS » Table » PRIMARY KEY »

 

Auto_INCREMENT primary key


mysql>
mysql>
mysql> CREATE TABLE myTable
    -> (
    ->    ID SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
    ->    Name VARCHAR(40NOT NULL,
    ->    PRIMARY KEY (ID)
    -> );
Query OK, rows affected (0.03 sec)

mysql>
mysql> desc myTable;
+-------+----------------------+------+-----+---------+----------------+
| Field | Type                 | Null | Key | Default | Extra          |
+-------+----------------------+------+-----+---------+----------------+
| ID    | smallint(5unsigned | NO   | PRI | NULL    | auto_increment |
| Name  | varchar(40)          | NO   |     |         |                |
+-------+----------------------+------+-----+---------+----------------+
rows in set (0.00 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 Table
» PRIMARY KEY