I am trying to normalize a database I am building. One part of it is that I have many different tests that each can have many different tags. How would you deal with this?
Would you have a table with your tags and then have a limit on the number of tags per test?
I am new to databases let alone the whole idea of normalizing so forgive me if this is a very simplistic question.
Usually, this’d be dealt with using two tables. A
tagstable, with each record consisting of atag_idandtag_name(and potentially other metadata you want to include). Tags would then be associated with their tests via another table,test_tags, in whichtest_idandtag_idwould be stored.If you want to limit the number of tags per test, you can easily run a
SELECT COUNT(tag_id) FROM test_tags WHERE test_id=#query to figure out how many they’ve already added to it.