I have a very basic table, consisting of an auto_incrementing id column (primary key), and a TEXT column containing some various text.
I need to insert data into this table, but I don’t want to insert duplicate rows. I thought using INSERT IGNORE INTO but apparently the IGNORE uses the table’s key to determine if the row is a duplicate or not. Since the key field in my table is auto incrementing, that means a duplicate will never appear to show up.
Is there a better approach to my table design? Does the TEXT column need to be a key also?
Make an UNIQUE index for your TEXT column :
errors will be ignored.
See http://dev.mysql.com/doc/refman/5.1/en/insert.html