patternsqlMinor
Database model about libraries
Viewed 0 times
databaselibrariesmodelabout
Problem
I need to make database model about libraries. In that model I'm tracking more libraries and every library has it's own moderators. Every moderator can make categories of the books and than add books in categories (note: another library doesnt need to have same as categories of books as library where that moderator is working, every other library can have different categories of books .. ).
This picture represents how did I make it. But something is missing, think this is not good solution. I have also another tought.. To link tables "book" and "category_book" in N:M and than link "book" and "libraries" which from I can get everything I need. But, think it's also not the best solution because every library will in that moment has same categories of books.
Am I missing something or? Haven't met with this kind of problem yet so if you could help me I will be grateful
Whole design ...Note: it's not over, I can't move further beacuse of this problem
This picture represents how did I make it. But something is missing, think this is not good solution. I have also another tought.. To link tables "book" and "category_book" in N:M and than link "book" and "libraries" which from I can get everything I need. But, think it's also not the best solution because every library will in that moment has same categories of books.
Am I missing something or? Haven't met with this kind of problem yet so if you could help me I will be grateful
Whole design ...Note: it's not over, I can't move further beacuse of this problem
Solution
Description
I'm synthesising that these are your constraints:
Solution
This should all be achievable via the following structure (ignoring your wider solution space with users, borrowing, etc):
Note: The link between
I'm synthesising that these are your constraints:
- One
Bookcan be in MANYCategory's, but only in ONECategoryperLibrary.
- Each
Librarycan have ZERO or moreCategory's, which they do not have to "share" with otherLibrary's.
Solution
This should all be achievable via the following structure (ignoring your wider solution space with users, borrowing, etc):
Note: The link between
library_has_category and book_in_library_category is a composite key of the library AND category keys together.Context
StackExchange Database Administrators Q#133439, answer score: 3
Revisions (0)
No revisions yet.