MySQL Forums
Forum List  »  Newbie

Re: skip duplicate entries
Posted by: Nick Roper
Date: August 14, 2004 02:29AM

krazy,

short answer - yes

longer answer - it depends on the import method you use and how you have indexes configured. For example, here is an extract from the on-line reference:

" ... If you specify the IGNORE keyword in an INSERT with many rows, any rows that duplicate an existing UNIQUE index or PRIMARY KEY value in the table are ignored and are not inserted. If you do not specify IGNORE, the insert is aborted if there is any row that duplicates an existing key value. You can determine with the mysql_info() C API function how many row's were inserted into the table..."

Full details at: http://dev.mysql.com/doc/mysql/en/INSERT.html

If you are loading data from a delimited text file - rather than executing multiple INSERT statements, the you can use the LOAD DATA INFILE statement, which also has options to ignore duplicates, see:

http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html

Hope this helps,

Nick

--
Nick Roper

Options: ReplyQuote


Subject
Written By
Posted
August 14, 2004 01:46AM
Re: skip duplicate entries
August 14, 2004 02:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.