I'm posting tags as tag1,tag2,tag3,ect... However I am unclear about how you can produce the database layout when it comes to performance and professionalism.
When someone clicks a tag, I wish to query and pull-up every page which has that tag.
The tags themselves get into a tags table. This table has only unique tags
TAGS id | tagname 1 stack 2 overflow
You produce a research table to complement the tag table towards the pages table
PAGES_TAGS tag_id | page_id 1 13 1 24 1 11 2 12
After this you perform a join to question which pages have which tags.
SELECT * FROM pages p INNER JOIN pages_tags pt ON p.id = pt.page_id INNER JOIN tags t ON t.id = pt.tag_id WHERE tag.name='overflow'
If this sounds like all that's necessary, then getting:
tagfields, maybe another fields connected using the tag, i.e. description, permissions, ...
page_tagstags table with
page_idfields to carry the numerous-to-many relationship between your tags and pages (presuming that you've a
page_idbecause the index column). You may even consider any extra fields, like time and date once the tag was added, who added the tag, etc.)
But afterwards you might like to add such things as tags cloud, that will need some data caching (you shouldn't rebuild your tags could each time someone tags something, rather get it done periodically, daily, for instance). To do this you could include another table