Reputation: 12695
I have that database diagram (MySQL). Each Book
has assigned a BookLanguage
. Each BookLanguage
has two different LanguageNames
(the globalization purpose). And also, each Book
can have an additional BookLanguage
(but it's not required).
And here's the problem - I'm stuck here while building a SQL query for searching for that Books
, whose have some string in the BookLanguageNames
. It's simple to build the query with joining the BookLanguage
and BookLanguageNames
but how to cope with the AdditionalBookLanguages
?
Upvotes: 1
Views: 168
Reputation: 2867
How about simplifying the database design? Have three tables Book
, BookLanguageName
(both of them similar structure to yours) and, instead of AdditionalBookLanguage
and BookLanguage
have a "lookup table" - BookLanguage
:
Book
- here you keep all the information about the books.BookLanguage
- only three columns: BookID, BookLanguageID (or Code) and a boolean is_additional. BookID and BookLanguageID would be a composite primary key.Language
- here you keep all information related to a particular language.In such case, writing query would be easier.
Upvotes: 1