-
-
Save gowtham758550/fc5555bfdbeebf4b6de90367457c92f7 to your computer and use it in GitHub Desktop.
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
--student table | |
CREATE TABLE [dbo].[Student] ( | |
[StudentID] INT IDENTITY (1, 1) NOT NULL, | |
[LastName] NVARCHAR (50) NULL, | |
[FirstName] NVARCHAR (50) NULL, | |
[EnrollmentDate] DATETIME NULL, | |
PRIMARY KEY CLUSTERED ([StudentID] ASC) | |
) | |
--course table | |
CREATE TABLE [dbo].[Course] ( | |
[CourseID] INT IDENTITY (1, 1) NOT NULL, | |
[Title] NVARCHAR (50) NULL, | |
[Credits] INT NULL, | |
PRIMARY KEY CLUSTERED ([CourseID] ASC) | |
) | |
--enrollment table | |
CREATE TABLE [dbo].[Enrollment] ( | |
[EnrollmentID] INT IDENTITY (1, 1) NOT NULL, | |
[Grade] DECIMAL(3, 2) NULL, | |
[CourseID] INT NOT NULL, | |
[StudentID] INT NOT NULL, | |
PRIMARY KEY CLUSTERED ([EnrollmentID] ASC), | |
CONSTRAINT [FK_dbo.Enrollment_dbo.Course_CourseID] FOREIGN KEY ([CourseID]) | |
REFERENCES [dbo].[Course] ([CourseID]) ON DELETE CASCADE, | |
CONSTRAINT [FK_dbo.Enrollment_dbo.Student_StudentID] FOREIGN KEY ([StudentID]) | |
REFERENCES [dbo].[Student] ([StudentID]) ON DELETE CASCADE | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment