(original) Attention, fan relationship database design

Source: Internet
Author: User

Mainly on the first three fields, and of course 4 fields


from_user_id to_user_id Mutual Powder Status both_status (Rel_type)
A b YES a focus on b,a become a fan of B (also need to add 1 in the statistics)
b A YES B concerned about a A a fan (also need to add 1 in the statistics, need to detect, a is not already concerned about B, if already concerned, then modify the status of two records is YES, to indicate the mutual powder)
A C NO
D A NO

Query a fan, with to_user_id, through the return of the Both_status, to determine whether a is a one-way, or two-way relationship
Query a two-way fan, to_user_id, status (YES)


Concern:
I am concerned about who: FROM_USER_ID is my id, query can

Fans:
This page shows my fans: people follow my
Use to_user_id, my ID, to query can

(original) Attention, fan relationship database design

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.