[ale] newb mysql question: unique table serial #s

Chris Woodfield rekoil at semihuman.com
Sun Mar 9 13:06:17 EDT 2008


Sent email about 10 min too soon; the answer was the auto_increment  
attribute.

-C

On Mar 9, 2008, at 12:46 PM, Chris Woodfield wrote:

> I'm working on a perl script that talks to mysql for the first time,
> and I'm coming up with all sorts of basic questions as to how to
> structure the database table.
>
> One thing that my db will need is a sequential index/serial number, so
> that records can be returned and sorted in sequence to their entry. I
> know timestamps could do this, but I can't have duplicates.
>
> The "hard way" of doing this would be to select * sorted by serial,
> pop the last element, get its $serial, then $serial++ and store the
> new entry using that value. But I find it hard to believe that there
> isn't a more efficient way of doing this.
>
> Is there any "autoincrement" function in mysql that would perform this
> function? What about a "return most recently created row" function?
>
> I know these are probably basic questions...if anyone can point me to
> a good FAQ that would be a great help...
>
> Thanks,
>
> -C
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>



More information about the Ale mailing list