mysql - Help with database design -
I would like some advice on designing my database tables for a small project, on which I am working. In this system, assume that I have article
, sub-article
, and comments
.
Each article can have sub-articles, both articles and sub-articles can have comments. I am considered to be an AutoIncreiting Inti Primary Key for each table (such as article ID, sub-article, and comment id). Sub-articles will contain an article which is in the form of a foreign key in the article
table etc.
But for some reason I have the perception of the unique ID of the world. What would be the best way to implement this? Should each table have a uuid
primary key and the first mentioned id column should be used as a regular column (since I still would like a logical number associated with each object)? Or should I create the main object
mapping table with the uuid
?
Any suggestions on the good way to implement it will be appreciated!
I have tables now articles
and comments
, and there will be a null-eligible ParentArticleID
field in the paragraph table.
article ------- Article ID (int PK) guardian article int FK) ... Comment ------- Comment ID (Ent PK) Article ID (int FK) ...
If you need a GUID, then do not use it as a PK because it will not display even during indexing. Create different fields for the GUID.
Comments
Post a Comment