Blog Post comment Database Design

Source: Internet
Author: User

 

User 1 wrote an article (ID = article1)

Oh, oh, NO, NO.

Oh, oh, NO, NO.

Oh, oh, NO, NO.

Oh, oh, oh, NO, NO.

 

User 2: This article is too ugly (comment1)

User 1: @ user 2: Thank you for your reply (comment
2)

User 3: @ Use 2: I also come to join in to reply (comment3)

User 2: @ user 3: reply (comment
4)

User 4: This article is okay. Reply (comment1)

User 5: @ user 4: I also reply (comment
4)

 

Database ideology: (comments)

1.
All comments and replies are treated as comments to the article.

2.
Representation Method (corresponding to the database)

Comment_id

Comment_pid

Comment_uid

Comment_content

Comment_parent

Comment_owner

 

Article ID

Text comment ID

User ID

Comment

Reply

Which comment does it belong?

 

Database example

Article 1

Comment 1

User2

This article is too ugly

Null

Null

Article 1

Comment 2

User1

Thank you.

Comment1

Comment1

Article 1

Comment 3

User3

I also come to join in

Comment1

Comment1

Article 1

Comment 4

User2

Haha

Comment3

Comment1

Article 1

Comment 5

User4

This article is fine.

Null

Null

Article 1

Comment 6

User5

Me too

Comment5

Comment5

There are similar attributes such as comment time. You can add them by yourself. Here I only list the core things and understand Long live.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.