I should have stated that I have read about REPLACE but am unsure how to use this with the load data infile command.
Also, I am unsure how this works with constraints and INNODB tables.
For example, here's my products table:
CREATE TABLE products (
item_num VARCHAR(20) NOT NULL,
supplier_num VARCHAR(10) NOT NULL,
name VARCHAR(100),
description VARCHAR(1000),
size VARCHAR(255),
color VARCHAR(255),
logo_method VARCHAR(100),
logo_loc_size VARCHAR(100),
turnaround VARCHAR(255),
addl_notes VARCHAR(255),
setup DECIMAL(6,2),
catID VARCHAR(20) NOT NULL,
index (catID),
subcatID VARCHAR(20) NOT NULL,
index (subcatID),
PRIMARY KEY (item_num),
index (supplier_num),
FOREIGN KEY (supplier_num) REFERENCES suppliers (supplier_num)
ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY (catID) REFERENCES category (catID)
ON UPDATE CASCADE ON DELETE RESTRICT,
FOREIGN KEY (subcatID) REFERENCES category (subcatID)
ON UPDATE CASCADE ON DELETE RESTRICT
) ENGINE=INNODB;
Other tables reference the above products table and have constraints linking to that table. So if I have and ORDER that references a product in the above table, and if i reload the data using the REPLACE command, which essentially DELETES and then INSERTS, I should assume that it won't let me do this right? It will probably try to delete and then say that it cannot because a "foreign key constraint fails, blah, blah, etc." .?.
So first question is regarding the syntax with using REPLACE with the load data infile command.
Second question is will this work with INNODB tables anyway.
Thanks.
Jonathan