mysql>
mysql> CREATE TABLE insect
-> (
-> id INT UNSIGNED NOT NULL AUTO_INCREMENT,
-> PRIMARY KEY (id),
-> name VARCHAR(30) NOT NULL, # type of insect
-> date DATE NOT NULL, # date collected
-> origin VARCHAR(30) NOT NULL # where collected
-> );
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO insect (name,date,origin)
-> VALUES('cricket','2010-09-11','basement');
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> SELECT LAST_INSERT_ID( );
+-------------------+
| LAST_INSERT_ID( ) |
+-------------------+
| 1 |
+-------------------+
1 row in set (0.00 sec)
mysql>
mysql> drop table insect;
Query OK, 0 rows affected (0.00 sec)