Created
April 15, 2021 03:44
-
-
Save blaiseAI/705b84e2bfdb14409ec0aee223f15176 to your computer and use it in GitHub Desktop.
DML Starter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE Blogs ( | |
BlogId INT IDENTITY (1, 1) NOT NULL, | |
Name NVARCHAR (200) NULL, | |
Url NVARCHAR (200) NULL, | |
CONSTRAINT [PK_dbo.Blogs] PRIMARY KEY CLUSTERED ([BlogId] ASC) | |
); | |
CREATE TABLE Posts ( | |
PostId INT IDENTITY (1, 1) NOT NULL, | |
Title NVARCHAR (200) NULL, | |
Content NTEXT NULL, | |
BlogId INT NOT NULL, | |
CONSTRAINT [PK_dbo.Posts] PRIMARY KEY CLUSTERED (PostId ASC), | |
CONSTRAINT [FK_dbo.Posts_dbo.Blogs_BlogId] FOREIGN KEY ([BlogId]) REFERENCES [dbo].[Blogs] ([BlogId]) ON DELETE CASCADE | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment