/* categories forums topics ---------- ------ ------ category_id <--. forum_id <----. topic_id name `---> category_id <-.`----> forum_id `-------------------`----> category_id post post_tags tags ---- --------- ---- post_id <-----------> post_id .----> tag_id name tag_id <------^ name */ /* CREATE TABLE posts ( post_id int(10) auto_increment, name varchar(255), primary key(post_id) ); CREATE TABLE post_tags ( post_id int(10), tag_id int(10) ); CREATE TABLE tags ( tag_id int(10) auto_increment, name varchar(30), primary key(tag_id) ); INSERT INTO posts (post_id,name) VALUES (1,'first'), (2,'second'),(3,'third'); INSERT INTO post_tags (post_id,tag_id) VALUES (1,1),(1,2),(2,1); INSERT INTO tags (tag_id,name) VALUES (1,'tag1'),(2,'tag2'); */