Inserting records into normalized db
Posted: Sat Dec 19, 2009 5:13 pm
I posted question several months earlier, I researched a bit and decided to normalize my db.
So, I have, one table - books with all book relevant data, one authors table with author data, and one join table with book_id and author_id.
I was surprised I could not find the answer to a simple question - how do I add record into such, typical database. When a user fills the form with one book and authors, there should be one entry in books table, one or more entry in authors table and one or more entries in join table. How do I get IDs for the join table?
So, I have, one table - books with all book relevant data, one authors table with author data, and one join table with book_id and author_id.
I was surprised I could not find the answer to a simple question - how do I add record into such, typical database. When a user fills the form with one book and authors, there should be one entry in books table, one or more entry in authors table and one or more entries in join table. How do I get IDs for the join table?