I am just learning normalization, so please forgive me if this is a dumb question.
I have a table TBL_Users
with the Primary Key being ID
. To track who is friends with who my most recent thought was to do a table with two Foreign Keys, both of which are the other person's ID. However the more I think about this I can't help but think there has got to be a better way.
+----+------+ | ID | Name | +----+------+ | 1 | Al | | 2 | Bob | +----+------+
That model means either I have to duplicate all the information or call the TBL_Friends twice.
IE if the table is
+----+--------+ | ID | Friend | +----+--------+ | 1 | 2 | | 2 | 1 | +----+--------+
Then I have duplicated information and have to make two calls to add/delete friends.
On the other hand if I just do
+----+-----+ | ID | ID2 | +----+-----+ | 1 | 2 | | 3 | 1 | | 4 | 1 | +----+-----+
The situation seems to be even worse because I have to query the database twice any time I want to do anything, be it gather information or add/delete friends.
Surely there is a simpler solution I am overlooking?