本次学习用到的数据库初始化脚本如下
use KMS create table Blog_User ( UserId int primary key identity(1,1), NickName nvarchar(10), CreateTime datetime ) create table Blog_LeaveMsg ( ID int primary key identity(1,1), ReceiverId int, foreign key(ReceiverId) references Blog_User(UserId), LeaverId int, foreign key(LeaverId) references Blog_User(UserId), CreateTime datetime, [Content] nvarchar(255) ) create table Blog_UserInfo ( ID int, foreign key(ID) references Blog_User(UserId), Introduce nvarchar(255), RealName nvarchar(10) ) insert into Blog_User values(‘Kimisme‘,‘2016-1-11‘) insert into Blog_User values(‘FriendLee‘,‘2016-1-12‘) insert into Blog_User values(‘FriendZhao‘,‘2016-1-13‘) insert into Blog_UserInfo values(1,‘大家好,我叫金某‘,‘金某‘) insert into Blog_UserInfo values(2,‘大家好,我叫李某‘,‘李某‘) insert into Blog_UserInfo values(3,‘大家好,我叫赵某‘,‘赵某‘) insert into Blog_LeaveMsg values(1,1,‘2016-1-20‘,‘我在看书,你在干嘛‘) insert into Blog_LeaveMsg values(1,2,‘2016-1-20‘,‘我在运动‘) insert into Blog_LeaveMsg values(1,3,‘2016-1-21‘,‘我在玩游戏‘) insert into Blog_LeaveMsg values(1,2,‘2016-1-23‘,‘羽毛球打的手好酸‘) insert into Blog_LeaveMsg values(1,3,‘2016-1-22‘,‘LOL五黑中‘) insert into Blog_LeaveMsg values(1,2,‘2016-1-25‘,‘每天散散步真不错‘) insert into Blog_LeaveMsg values(1,3,‘2016-1-24‘,‘我剑灵游戏又满级了‘) insert into Blog_LeaveMsg values(1,2,‘2016-1-25‘,‘要不要来打网球‘)
各表关系如下
时间: 2024-10-29 19:12:06