I currently busy with a project that I want to do for my second year at college... The project is all about users and contacts, each user can have many contacts and many contacts can belong to many users, since I see it as a many to many relationship I want to create a user_contact table. The relationship between a user and a contact can either be a friend,work college or family member..the relationship can also be either passive or active state.. I also want to keep track of who last edited the record of a contact and on what date by a certain user
The system will be used internally in a certain company and the system is all about showing the relationship that users have with contacts outside the company for example john is searching for pam that works for cola cola and he sees that phil that works with him also knows pam as a friend and the relationship is in a active state..
My current table structure:
//User table
user_id | username|password|fname|lname|email
//Contact_table
contact_id|fname|lname|contactnumber|email|lastedited|editdate
//User_contact table
id|user_id|contact_id|relationship_type|relationship_state
Since I'm new to the mysql environment my question is I'm I going the right way about it...Any advise will be very helpful..
And how do I link the user id from user table to the user id in the user_contact table and the same for the contact id ??