Database model about libraries 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
Description

I'm synthesising that these are your constraints:


One Book can be in MANY Category's, but only in ONE Category per Library.
Each Library can have ZERO or more Category's, which they do not have to "share" with other Library's.


Solution

This should all be achievable via the following structure (ignoring your wider solution space with users, borrowing, etc):





Note:&nbsp; The link between library_has_category and book_in_library_category is a composite key of the library AND category keys together.