From: Reindl Harald Date: February 9 2011 12:19pm Subject: Re: Auto-Increment Values in Mysql List-Archive: http://lists.mysql.com/mysql/224341 Message-Id: <4D528669.1070100@thelounge.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig3207AA3903A524E2DB7189BC" --------------enig3207AA3903A524E2DB7189BC Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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, >=20 > I have an auto-increment column in Mysql database table.=20 > Let's say the column has below values : > Now if i deleted some rows where id=3D 3 ,5 and 8 >=20 > The data look like as : >=20 > 1 > 2 > 4 > 6 > 7 > 9 > 10 >=20 > 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. --=20 Mit besten Gr=FC=DFen, Reindl Harald the lounge interactive design GmbH A-1060 Vienna, Hofm=FChlgasse 17 CTO / software-development / cms-solutions p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40 icq: 154546673, http://www.thelounge.net/ --------------enig3207AA3903A524E2DB7189BC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAk1ShmoACgkQhmBjz394AnmhXQCffhoGiNSIFt9Z6RFQJCgJ8+u7 EGoAnjitaNK67nGgc54nfOQ2phRLbm/o =7J/I -----END PGP SIGNATURE----- --------------enig3207AA3903A524E2DB7189BC--