SocialNetworking Website Database Structure in SQL Server
Database Structure and Tables for SocialNetworking Website in SQL Server
Open SQL Server Management Studio 2008/2005 and Open a new Query Window.You can also open new query window using shortcut key Clt+NIn the New Query Window create a database Named HeartBeatDB using the Following Script
use master
create database HeartBeatDB
go
Database Tables SQL Script:
For this project we are creating three tables Register,Posts and Friends. Once the Database is Created with the Name HeartBeatDB you can execute the below script to create tables required for social networking websiteUSE [HeartBeatDB]
GO
/****** Object: Table [dbo].[Register] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Register](
[RegisterId] [int] IDENTITY(1,1) NOT NULL,
[EmailId] [varchar](50) NULL,
[Pwd] [varchar](50) NULL,
[Gender] [varchar](10) NULL,
[DOB] [varchar](10) NULL,
[AboutMe] [varchar](500) NULL,
[Country] [varchar](30) NULL,
[ProfilePic] [image] NULL,
[Name] [varchar](100) NULL,
PRIMARY KEY CLUSTERED
(
[RegisterId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Posts] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Posts](
[PostId] [int] IDENTITY(1,1) NOT NULL,
[FromId] [int] NULL,
[ToId] [int] NULL,
[Post] [varchar](1000) NULL,
[PostDate] [varchar](50) NULL,
PRIMARY KEY CLUSTERED
(
[PostId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Friends] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Friends](
[FriendshipId] [int] IDENTITY(1,1) NOT NULL,
[MyId] [int] NULL,
[FriendId] [int] NULL,
[Status] [int] NULL,
[MeOnline] [int] NULL,
[FriendOnline] [int] NULL,
[PingStatus] [int] NULL
) ON [PRIMARY]
GO
a.Register Table- it will store all the information provided by the user during registration
b.Posts Table - it will store all the posts written by the user on his wall or on his friends wall
c.Friends Table - it will store all the friendship status about the friend requests send
that's great ! thanks and God bless you brother !
ReplyDeletegreate
ReplyDeletei wont code please
ReplyDeletebasharali1991@yahoo.com
plss tel me where to add this code and how to open the SQL server management studio 2008???
ReplyDeleteif i develop another table called message, Do I want to set foreign key relationship? Here I didn't found any foreign key relationship. Without Foreign key relationship how it will work? explain please.
ReplyDeleteHOW TO create table and where to paste this code
ReplyDelete