Monday, October 20, 2014

BookReview ERD

Here is an ERD (Entity Relation Diagram) of the BookReview database. I did not include all the attributes for each table. Note the One to One relationship between Reviewer and Login.

You can click the image to get a larger view

Comments on relationships:

There is a many to many relationship between Book and Author. Each book can have many authors, each author can have many books. To resolve this we need to create a linking table BookAuthor that matches author with book. I made the key for the linking table a composite key that contains both the BookKey and the AuthorKey. This makes it so the same author can't be cited twice for the same book. The pair always must be unique.

The relationship between Category and Book is also many to many and requires a linking table: BookCategory.

The review table is tied to the reviewer and the book table. Both are one to many. One book can be reviewed many times. On reviewer can review many books.

Comments are related to Review and Reviewer in the same way. On Review can have many comments and one Reviewer can make many comments.

There is one other table related to Reviewer. LoginTable stores the username and password for the Reviewer. The LoginTable has one child which is the LoginLog that logs every time a reviewer logs in.

No comments:

Post a Comment