Get rid of the authors column in books .
You have many different relationships between books and authors: some books have several authors, and some authors have written several books. And the books have the first, second and third authors, etc. You cannot display author names for a book in some unpredictable order. The authors and the publisher decide the author’s order, not the dbms programmer.
So you need a books_authors table with the following columns
book_id author_id author_ordinal (a number like 1,2,3 to denote the order of authors)
You can get a list of authors for a specific book with this query:
SELECT isbn, title, author_ordinal, first, last FROM books b LEFT JOIN books_authors ba ON (b.id = ba.book_id) LEFT JOIN authors a ON (ba.author_id = a.id) WHERE isbn = '978whatever' ORDER BY author_ordinal
It would also be wise for you to place a text box named role in your books_authors table if you want your software to be bibliographic-populated. People have different roles in creating books such as "author", "illustrator", "editor", series editor, "contributor", "author of preface", etc. The role column allows you to commit this information.
By the way, most dbms of reverse engineering tools will be much happier if you name your id columns in sequence. Therefore, you should use books.book_id and authors.author_id, not just books.id and authors.id.
source share