Simple Contact Management System
Today, we are going to go over Contact Management System. Shall we begin ?
A contact management system is basically relationship between users in the database. So, naturally we are going to have a users table.
Let us assume, our users table is like this:
ID -> auto increment ID of the user
Name -> the name of the user
Now, this user is going to be in contact with other user and have their contact table updated accordingly.
So, in the first draft, we are going to have our contact table:
ID -> auto increment ID of the contact
user_ID -> the contact ID, which is the user_ID of a contact
is_contact_of -> the owner of the contact list. Inside we will fill with the user_ID
So, basically, the contact table is a pair listing relationship between two users.
If we want to retrieve a list of contact, we simply do a query on table contact, the field “is_contact_of”.
One weakness of this method is that we are going to have a lot of data, because we do not assume inverse relationship is true.
For example, we have Jack in the contact list of Jill. This does not mean that Jill is in Jack contact list.
This will be the topic of the next post.