This is a pure design question. I have a library database (MS Access). Books can be part of a series (1:m). Books...
can have parts (1:m). Books have authors (m:m). Parts have authors (1:m). Now I want to add reviews to the database. But a review can be about a series, a book, a part, an author or a partAuthor. At this moment, I have different Review tables for each case. This makes it difficult (impossible?) to show reviews as one list (sorted on date for example). How can I get all reviews in one table? Like a 1:m to the different tables. I have autonumbers in there...
There are many ways that this can be done, but the simplest way I can think of would be to create a reviewSubjects table. It would have an AutoNumber PK (Primary Key), and an FK (Foreign Key) for each type of review (like series, book, and author). This gets a little ugly if you have to join beyond this table to produce a comprehensive result set to address every type of review, but that is a design decision that you may not have to make.
For More Information
- What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
- The Best Database Design Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your database design -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Related Q&A from Pat Phelan
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.