Loading data from file into MySQL table with foreign key constraint -
i need load data file table foreign key constraint. if have parent table populated , want populate child how find appropriate foreign key child. i.e. if have department , employee table employee contains fk_department_id no other identifying information department, how know department employee belongs to. thinking of using temporary tables contained identifying information department (like department name) in employee table , using join appropriate fk's. put info without identifying columns database, don't think best way it. first load data department table, , after execute following using department name in employee csv, ex.: department csv: deptname, manager ("finance","ted smith") department table: de_id, de_name, de_manager emplstrong textoyee csv: name, surname, deptname ("tom", "smith", "finance") employee table: em_id, em_name, em_surname, em_de_id load data low_priority local infile 'c:\\temp\\empl...