How to skip all column names in MySQL when the table has auto incrementing primary key?
Table:
mysql> desc gifts;
+---------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------+------+-----+---------+----------------+
| giftID | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(80) | YES | | NULL | |
| filename | varchar(80) | YES | | NULL | |
| effectiveTime | datetime | YES | | NULL | |
+---------------+-------------+------+-----+---------+----------------+
the following is done:
mysql> insert into gifts
-> values (10, "heart", "heart_shape.jpg", now());
Query OK, 1 row affected (0.05 sec)
but is there a way not to specify "10" ... and just let each one be 11, 12, 13 ...?
I can do this using
mysql> insert into gifts (name, filename, effectiveTime)
-> values ("coffee", "coffee123.jpg", now());
Query OK, 1 row affected (0.00 sec)
but the column names must be specified. Is there a way they shouldn't be specified and the auto incrementing of the primary key still works? thanks.
+2
a source to share