How to insert data to multiple tables with foreign key dependencies involved (MySQL)
问题 I am looking for the best-practice way to insert data to multiple MySQL tables where some columns are foreign key dependencies. Here is an example: Table: contacts -------------------------------------------------------------------- | contact_id | first_name | last_name | prof_id | zip_code | -------------------------------------------------------------------- The 'contacts' table has PRIMARY KEY (contact_id) which simply auto_increments, and FOREIGN KEY (prof_id) REFERENCES 'profession'