4 messages in com.mysql.lists.mysqlRe: Serial number
FromSent OnAttachments
Mike01 Oct 1999 00:55 
sin...@cytanet.com.cy01 Oct 1999 04:19 
Bob Kline01 Oct 1999 04:35 
Davor Cengija01 Oct 1999 04:53 
Subject:Re: Serial number
From:Davor Cengija (dav@linuxfan.com)
Date:10/01/1999 04:53:53 AM
List:com.mysql.lists.mysql

On Fri, 1 Oct 1999, Mike wrote:

Hi list. Is there a way to create a serial number for rows ? lets say that i want to create a table that by default inserts a serial number into sn column.

Can it be done ?

I guess you're looking for a unique counter for the rows.

CREATE TABLE tbl( sn int unsigned not null primary key auto_increment, title char(24) );

INSERT INTO tbl ('', 'Some title'); INSERT INTO tbl ('', 'Another title');

Some title will have sn = 1 and Another title will have sn = 2 and so on.

So, auto_increment is the work you're looking for.

Check the manual.