If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > auot-generation of a column value

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-11-03, 22:53
poojajt poojajt is offline
Registered User
 
Join Date: Sep 2003
Location: CA
Posts: 38
auot-generation of a column value

Hi,
How do I create a column which has an auto-generated number i.e. unique serialized number that increments by 1 on every insertion of a row?
Thanx.
Pooja
Reply With Quote
  #2 (permalink)  
Old 11-12-03, 02:07
padm2016 padm2016 is offline
Registered User
 
Join Date: Oct 2003
Posts: 16
An example:

create table Student(id int auto_increment primary key, name varchar(30)) type=innodb;

mysql> insert into Student values(NULL, "Prasanna");

Inserting a NULL value will increment the value of id everytime.

Prasanna
Reply With Quote
  #3 (permalink)  
Old 11-17-03, 15:47
poojajt poojajt is offline
Registered User
 
Join Date: Sep 2003
Location: CA
Posts: 38
hey thanx a lot for that...looks really cool....goin' to try it now!
pooja

Quote:
Originally posted by padm2016
An example:

create table Student(id int auto_increment primary key, name varchar(30)) type=innodb;

mysql> insert into Student values(NULL, "Prasanna");

Inserting a NULL value will increment the value of id everytime.

Prasanna
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On