开发者

MySQL Help with storing data [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_如何转开发 Closed 11 years ago.

I am making a database for a client where I will have an Account and in that account I want to have the post's of that account along with the post's data (likes, comments). How could i store the posts (along with their data) in the database?


Lets suppose you have this data to handle (accounts,posts,likes,comments) you should create a different table for each of these 'objects'.So you will have:

TABLE accounts (id,name,email..)
TABLE posts (id,title,text,account_id[FK]..)
TABLE likes (id,value,post_id[FK])
TABLE comments (id,tect,datetime,post_id[FK])

where the 'id' fields are AUTO-INCREMENT index and the fields followed by the 'FK' are foreign keys. If you're not sure what a foreing key is give a look here doc

try being more detailed next time if you need an answer that goes straight-to-the-point!

Hope it helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜