List:General Discussion« Previous MessageNext Message »
From:Reindl Harald Date:February 9 2011 12:19pm
Subject:Re: Auto-Increment Values in Mysql
View as plain text  
You do not want this really from the point you understood
what a primary key does in a database

The PRIKEY is unqiue for a record and if the record
does no longer exist his PRIKEY must never return

Sample:
* website
* shop-products
* you have prodid 500 costs 200$
* you delete the product
* there are bookmarks out there
* they NEVER should point to another product what costs 5.000 $ as sample

in no rdbms auto_increment values are reused and if than
you have found a hard bug

Am 09.02.2011 12:41, schrieb Adarsh Sharma:
> Dear all,
> 
> I have an auto-increment column in Mysql database table. 
> Let's say the column has below values :
> Now if i deleted some rows where id= 3 ,5 and 8
> 
> The data look like as :
> 
> 1
> 2
> 4
> 6
> 7
> 9
> 10
> 
> I want to have it id's as
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> and next data is inserted right at 8
> Please help how to achieve it.

-- 

Mit besten Grüßen, Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / software-development / cms-solutions
p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40
icq: 154546673, http://www.thelounge.net/


Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Thread
Auto-Increment Values in MysqlAdarsh Sharma9 Feb
  • Re: Auto-Increment Values in MysqlMark Goodge9 Feb
  • Re: Auto-Increment Values in MysqlReindl Harald9 Feb
Re: Auto-Increment Values in MysqlJan Steinman9 Feb