mysql inserting into 2 tables at once that have primary key and foreign key
问题 I have two tables books table ID (PK) Title Author Genre ISBN Price publisher Year bookAwards table ID (FK) -- referencing Books.ID Awardname Year ID of bookAwards is foreign key of ID in books table. How can I insert into books table at the same time into bookAwards table? When I am trying to insert into books table it gives the error that foreign key causes? I want to insert into books table the values and then an awardname with a year into bookAwards? Any help will be much appreciated. 回答1