Hi, I want to design DB for posts with multiple subcategories and categories.
Example:
Category has information: C#, PHP, JS, Python.
Subcategory can contain: Logger, String, While Loop.
A post table contain posts about "while loop" in PHP language and posts about "while" loop in C#.
So, this is a many-to-many relation? Then I have to put middle table in between, but how?
Using MySql.
I designed a scheme, worked on stored procedures, php but I have to dismiss it all because I'm missing something.
I could delete subcategories and stick to only categories and use tags? That is simplier solution, but not professional.
So far:
tblCat
idCat (int, unique, autoinc)
name
tblSubCat
idSubCat (int, unique, autoinc)
name
idCat (fk - references tblCat)
tblPosts
idPost (int, unique, autoinc)
name
tblSubCat (fk - references tblSubCat)
tblCat (fk - references tblCat)
tblTags
idTag (int, unique, autoinc)
tagName
tblTagPostMap
idTag (fk - references tblTags)
idPost (fk - references tblPosts)
If there is an answer already, please, share the link. Thank you!!