List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 22 1999 10:45am
Subject:duplicate entries in the mysql DB
View as plain text  

>>>>> "Chris" == Chris W <falco@stripped> writes:

Chris> Hello everyone, I have a question about duplicate entries in the database.
Chris> Let say I have database and have ProductID that is my index and it is auto
> incremented, but I found that there are few entries that are duplicate. Now I want to
> remove those entries, will I have to reindex the DB? or can I leave it as it is? When new
> entry will be added will it use the next available auto incremented index number or will
> it use the spot that was available when the previous entry was removed?

If you are using an ISAM (.ISD) table, new entries will be inserted
with the id = MAX(id)+1   ; This means that if you delete the biggest
id, it will be reused. (This is fixed in MySQL 3.23 when you use MyISAM).

Chris> Also what is the syntax to remove the whole entry in the database that is
> assigned to that particular product? Thank you very much.

Sorry, I am now 100 % sure what you meant.  Are you talking about
databases or tables? (A database is a collection of tables)

DELETE FROM table_name WHERE id=some_id.;

Chris> Those are my first steps with the DB so please do not comment this in negative
> way because remember when you started.

Chris> Thank you very much for your time and help.

Chris> Chris


*************** Warning commercial signature follows **********
If you like TCX's concept of a 'mostly free' database and free
advice, you should at least CONSIDER supporting us, so that we can
afford to continue this service up.
duplicate entries in the mysql DBChris W.22 Sep
  • duplicate entries in the mysql DBMichael Widenius22 Sep