Note that there are some explanatory texts on larger screens.

plurals
  1. PODB Schema for Facebook like Wall + "Shared links"
    text
    copied!<p>I am making a db schema for facebook like wall structure. I need to save wall posts, share a link, share a video stuff into my database. Till now I am able to make this schema :</p> <pre><code>GO CREATE TABLE [Wall] ( [ID] [int] NOT NULL IDENTITY(1, 1) , [PostText] [nvarchar](MAX) [PostedByUserID] [int] NULL , [PostedOnUserID] [int] NULL , [DateCreated] [datetime] NULL ) GO </code></pre> <p>Next I have to add the schema for adding the "share a link" and "share a video" feature. </p> <pre><code>GO CREATE TABLE [Wall] ( [ID] [int] NOT NULL IDENTITY(1, 1) , [WallText] [nvarchar](MAX) [PostedByUserID] [int] NULL , [PostedOnUserID] [int] NULL , [DateCreated] [datetime] NULL, [SharedLink] [nvarchar](1024) NULL , [SharedLinkTitle] [nvarchar](512) NULL , [SharedLinkDesc] [nvarchar](512) NULL , [SharedLinkImageSrc] [nvarchar](512) NULL ) GO </code></pre> <p>Now with this schema:</p> <p>1st case: When the wall post is inserted the [SharedLink], [SharedLinkTitle],[SharedLinkDesc], [SharedLinkImageSrc] columns will be inserted as null and rest of the columns will have the values.</p> <p>2nd case: When the "link shared" is inserted the "[WallText]" column will be inserted as null and rest of the columns will have the values.</p> <p>For my case 70% of the time the wall post will be made and 30 % "links" will be shared which means 70 % of the cases [SharedLink], [SharedLinkTitle],[SharedLinkDesc], [SharedLinkImageSrc] will be inserted as null. Now my concern is that is it okay to keep the null columns inserted or I should go for a separate table for "shared a link" purpose and have the separated table like this:</p> <pre><code>GO CREATE TABLE [LinkShared] ( [ID] [int] NOT NULL IDENTITY(1, 1) , [PostedByUserID] [int] NULL , [PostedOnUserID] [int] NULL , [SharedLink] [nvarchar](1024) NULL , [SharedLinkTitle] [nvarchar](512) NULL , [SharedLinkDesc] [nvarchar](512) NULL , [SharedLinkImageSrc] [nvarchar](512) NULL ) GO </code></pre> <p>I have to go in similar manner to add the schema for sharing the videos further. Please guide me in which direction should I move ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload