0

I am just designing a DB with 4 tables and these tables have a many to many relationship with each other. So it's not just books and authors, but language A, B, C, D .How many intermediary tables will I need?

16? Or is it just one with 4 columns ?

I am a newbie and quite in despair, because I could not find any info on such a case. Please help.

I see this is not enough info.

There will be 4 languages like english, germangerman, austriangerman, swissgerman and it should be possible to query from all to all.

So as far as I learned RDBMS , this should be many to many relationships. So the questions is should I create for each pair of tables one intermediary table or would one table with 4 columns be enough?

3
  • 2
    You may want to describe your model in greater detail than that.
    – mustaccio
    Nov 8, 2022 at 22:09
  • 4 tables and these tables have a many to many relationship with each other I.e. 6 M:N relations? I doubt that this can work.. Maybe you mean the case with only one base table and another tables related as M:N to it (3 relations)? Describe completely and detailed. PS. language may be a column with SET datatype.
    – Akina
    Nov 9, 2022 at 4:57
  • Help us to help you by following this link. dba.stackexchange.com/help/minimal-reproducible-example
    – armitage
    Nov 20, 2022 at 19:21

1 Answer 1

0

Why not one?

author_id ...,
book_id ...,
lang_code CHAR(2) CHARACTER SET ascii COLLATE ascii_general_ci,
dim_4 ??

You may need multiple INDEXes on this mapping table. Let's see the likely queries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.