I have two tables in my database.
Table 1 : book
book_id (Primary & Auto Increment)
book_name
writer_id (Foreign Key from writer table, selected as index)
Table 2 : writer
writer_id (Primary & Auto Increment)
writer_name
I can add only one writer to a book, but a book can be written by two or more writers. How can I achieve that?
I thought I could create two tables called writer_2 and writer_3 (since most books are written by 1, 2 or 3 writers) and add them as a foreign key to my table, but I am open to alternative solutions.
I am using phpmyadmin and my table storage engine is InnoDB.