Databases :: MySql :: syntax of auto increment field |
|||
| By: VB guy |
Date: 05/11/2004 19:30:00 |
Points: 125 | Status: Answered Quality : Excellent |
|
hi, i want a column serial no. insert into table with auto increment. please tell me the syntax of this new field. |
|||
| By: VGR | Date: 05/11/2004 19:51:00 | Type : Answer |
|
| ALTER TABLE yourtable ADD serialno integer unique auto_increment; see CREATE TABLE syntax at www.mysql.com in the online Manual |
|||
| By: Big_Red_Dog | Date: 05/11/2004 23:27:00 | Type : Comment |
|
| In your CREATE TABLE, the syntax is something like: serial_number INT UNSIGNED NOT NULL AUTO_INCREMENT |
|||
| By: Squibi | Date: 06/11/2004 03:58:00 | Type : Comment |
|
| If you have created your table already and do not wish to delete it and start over, I would use VGR statement above, with the exception of integer, which should be INT :) FYI, there is 5 Integer types for MySQL: INT, TINYINT, SMALLINT, MEDIUMINT, BIGINT. This does not include ENUM either. |
|||
| By: VGR | Date: 06/11/2004 04:24:00 | Type : Comment |
|
| non non non
dtc |
|||
|
Do register to be able to answer |
|||
| Add This Article To: | |||
| |
|
|
|
| |
|
|
|








