visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
294 experts, 1172 registered users, 1625 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


The DDRK link is back online.
We got a one week service interruption, sorry.
(23-30/01/2010)

Databases :: MySql :: syntax of auto increment field


By: VB guy Canada  Date: 05/11/2004 19:30:00  English  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 English  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 English  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 English  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 English  Type : Comment
non non non



MySQL supports all of the SQL-92 numeric data types. These types include the exact numeric data types (NUMERIC, DECIMAL, INTEGER, and SMALLINT), as well as the approximate numeric data types (FLOAT, REAL, and DOUBLE PRECISION). The keyword INT is a synonym for INTEGER, and the keyword DEC is a synonym for DECIMAL.



dtc

Do register to be able to answer

 Add This Article To:
 del.icio.usDel.icio.us  diggDigg  googleGoogle  spurlSpurl
 blinkBlink  wongWong  simpySimpy  yahooY! MyWeb 
EContact
browser fav
page generated in 65.502170 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page