
May 25th, 2000, 07:21 AM
|
|
Junior Member
|
|
Join Date: May 2000
Posts: 10
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by bydavid:
hello
i am trying to add a field into a mysql table that will auto increment by 1 for each new record that is inputed. i tried
create table newTable (
id integer(11) not null auto_increment primary key,
name varchar(20))
when i describe the table, i get this
Field Type Null Key Default Extra
----- ---- ---- --- ------- -----
id int(11) PRI 0 auto_increment
name varchar(20) YES NULL
but after adding some values with the following command "insert into newTable values(1,"sdf"), i get this
id name
-- ----
1 sdf
9 dffdsdf
3 23323dsffsdfdf
so the table is not autoincrementing the id column[/quote]
Hi,
In an autoincrement field, just type "null" as its value. MySQL will check the last inserted value and increment 1.
ex. insert into newTable values("null","sdf")
Bye,
G.Bubani
|