I have a subjects database, and I want to create a new tag database to tag the subjects, but I have no idea how to design the new tag database structure.
I'm assuming the new database looks like this:
tag_id tag_name tagged_subject_ids
1 tag1 1, 2, 3, 5, 10
2 tag2 2, 4, 5, 6, 10, 12
so, if I want to select the tags belong to subject 1:
SELECT tag_name FROM tag_database WHERE tagged_subject_ids LIKE '1';
I think the way that I select tag may be very slow, so please help me.
Thanks!