Solution
Now let's look at our solution.
Implementing the Database
Let's look at the tables that are needed to support these new features.
The Friends Table
As the concept of friends is our base discussion for this chapter, we will immediately dive in and start creating the tables around this subject. As you have seen previously this is very straightforward table structure that simply links one account to the other.
All these fields should be totally understandable. Here's the SQL:
CREATE TABLE [dbo].[Friends]( [FriendID] [int] IDENTITY(1,1) NOT NULL, [AccountID] [int] NOT NULL, [MyFriendsAccountID] [int] NOT NULL, [CreateDate] [smalldatetime] NOT NULL CONSTRAINT [DF_Friends_CreateDate] DEFAULT (getdate()), [Timestamp] [timestamp] NOT NULL, CONSTRAINT [PK_Friends] PRIMARY KEY CLUSTERED ( [FriendID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON...