sql - How to manage a contact relation in database -


i have create database schema manager user contacts. explain...

i have simple user table primary key (named id).

i have contact table having 2 foreign keys (senderid user, receiverid user) constituting primary key.

my problem if user send contact invitation user b, have following entry :

contact(a,b)

in case, can have entry contact(b,a) similar other entry.

how can manage case ?

thanks help.

i create 2 separate tables, 1 pending requests contactrequests(senderid, receiverid), , contact lists named contact(user_id,contact_id).

i store contact requests in contactrequests did , upon request validation, create 2 entries in contact this: contact(a,b) contact(b,a) , delete pending request. doing able user contact list independently sent request.

googling "many many relationship" design database.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -