this post was submitted on 24 Aug 2023
6 points (87.5% liked)
For all your programming needs
772 readers
1 users here now
A community to discuss programming and or related topics
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The latter. Creating millions of dynamic tables for this use case is not what SQL databases are designed for.
If you create a foreign key relationship from the clues table (column questionID) to the question table (column ID), the database will even guard for you that each clue actually has a valid question associated with it. What's more, if you setup cascading deletes 9n that foreign key relationship, you only need to delete a question row and the clues will automatically be deleted for you. As you can see, this type of relationship is best modeled this way. There are many more reasons why you should do this, but I'm hoping this gives a beginners overview.
Thanks for sharing your knowledge