Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE [dbo].[TopicKeyword] (
- [Id] SMALLINT NOT NULL,
- [Keyword] VARCHAR (100) NOT NULL,
- [Volume] INT NOT NULL,
- [PageId] SMALLINT NOT NULL,
- CONSTRAINT [PK_TopicKeyword] PRIMARY KEY CLUSTERED ([Id] ASC),
- CONSTRAINT [AK_TopicKeyword_Keyword] UNIQUE NONCLUSTERED ([Keyword] ASC),
- CONSTRAINT [FK_TopicKeyword_PageMeta] FOREIGN KEY ([PageId]) REFERENCES [dbo].[PageMeta] ([Id])
- );
- GO
- CREATE NONCLUSTERED INDEX [IX_TopicKeyword_PageId]
- ON [dbo].[TopicKeyword]([PageId] ASC);
- GO
- CREATE UNIQUE NONCLUSTERED INDEX [IX_TopicKeyword_Id_PageId]
- ON [dbo].[TopicKeyword]([Id] ASC, [PageId] ASC);
- CREATE TABLE [dbo].[TopicContent] (
- [ParentKeywordId] SMALLINT NOT NULL,
- [KeywordId] SMALLINT NOT NULL,
- CONSTRAINT [PK_TopicContent] PRIMARY KEY CLUSTERED ([ParentKeywordId] ASC, [KeywordId] ASC),
- CONSTRAINT [FK_TopicContent_TopicCluster] FOREIGN KEY ([ParentKeywordId]) REFERENCES [dbo].[TopicCluster] ([KeywordId]),
- CONSTRAINT [FK_TopicContent_TopicKeyword] FOREIGN KEY ([KeywordId]) REFERENCES [dbo].[TopicKeyword] ([Id]),
- CONSTRAINT [CK_TopicContent_ParentKeywordId] CHECK ([ParentKeywordId]<>[KeywordId])
- );
- GO
- CREATE NONCLUSTERED INDEX [IX_TopicContent_KeywordId]
- ON [dbo].[TopicContent]([KeywordId] ASC);
- CREATE TABLE [dbo].[TopicCluster] (
- [KeywordId] SMALLINT NOT NULL,
- [PageId] SMALLINT NOT NULL,
- CONSTRAINT [PK_TopicCluster] PRIMARY KEY CLUSTERED ([KeywordId] ASC),
- CONSTRAINT [AK_TopicCluster_PageId] UNIQUE NONCLUSTERED ([PageId] ASC),
- CONSTRAINT [FK_TopicCluster_TopicKeyword] FOREIGN KEY ([KeywordId]) REFERENCES [dbo].[TopicKeyword] ([Id]),
- CONSTRAINT [FK_TopicCluster_TopicKeyword2] FOREIGN KEY ([KeywordId], [PageId]) REFERENCES [dbo].[TopicKeyword] ([Id], [PageId])
- );
- GO
- CREATE NONCLUSTERED INDEX [IX_TopicCluster_KeywordId_PageId]
- ON [dbo].[TopicCluster]([KeywordId] ASC, [PageId] ASC);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement