Hi!

Let’s say I have a questions system and the writers of questions always add at least one but maybe more clues for the question.

Would it be better design to have each question have its own table for clues, even though the vast majority of the time the questions only have 1 clue? (ie is it inefficient to create like a zillion tables for a database?) Or would it be better to have a “clues” table, where each clue stores which question ID the clue applies to? (ie are later queries linear in time based on the amount of clues in the table which would be bad?)

Thanks for your help! And I’d appreciate motivations for the answers too so I will understand better.

  • vaseltarp@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago

    You can create one table for all the clues and then do a 1 to n relationship. You create a collumn for the question ID in the clue table. So one question can have more than one clue and each clue knows to which question it belongs.