Insert value to AUTO_INCREMENT column
mysql>
mysql> CREATE TABLE CITY_NAMES
-> (SEQNO INTEGER UNSIGNED AUTO_INCREMENT
-> NOT NULL PRIMARY KEY,
-> NAME VARCHAR(30) NOT NULL);
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql>
mysql> INSERT INTO CITY_NAMES VALUES (8, 'Bonn')
-> ;
Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO CITY_NAMES VALUES (NULL, 'Amsterdam')
-> ;
Query OK, 1 row affected (0.00 sec)
mysql> SELECT * FROM CITY_NAMES;
+-------+-----------+
| SEQNO | NAME |
+-------+-----------+
| 8 | Bonn |
| 9 | Amsterdam |
+-------+-----------+
2 rows in set (0.00 sec)
mysql>
mysql>
mysql> drop table CITY_NAMES;
Query OK, 0 rows affected (0.00 sec)
Related examples in the same category