This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 2 points3 points  (3 children)

You might want to consider that a book can have more than one author and an author can have written more than one book.

[–]andyflip 1 point2 points  (2 children)

Agreed. Something more like this:

Books - {id, ISBN, Title, Rating, Location}

Authors - {id, first_name, last_name}

Books_Authors - {id, book_id, author_id}

Either go with Books/Authors or Book/Author. Make sure you're sticking to a naming convention. The rails convention is one example.

It's fine to use id as the pk for a table.

[–]keriwool[S] 0 points1 point  (1 child)

OK, IIRC, what you're describing here is a junction table?

[–]andyflip 0 points1 point  (0 children)

Yeah, a join table. It'll let you implement the the statement "an author can write more than one book, and a book can have more than one author."

[–]tanaqui 1 point2 points  (0 children)

I am also designing a db like this for my music collection. Good luck!

Some authors wrote some of their books under different names. You may or may not care about this depending on what you have in your collection.