How to Create Table Creation in SQl Server

Table Creation:
The following example shows the table creation and the relationship diagram for student mark list.
Queries:
create table CourseDetail (  CourseID       INTEGER PRIMARY KEY NOT NULL,
    CourseName   VARCHAR(20))

create table GradeDetail (  GradeID       INTEGER PRIMARY KEY NOT NULL,
   GradeName  VARCHAR(20))

create table StudentDetail (  StudentID   INTEGER PRIMARY KEY NOT NULL,
                                             StudentName VARCHAR(20),
                                              Address  VARCHAR(50),
      CourseID   INTEGER FOREIGN KEY
                                                                                     REFERENCES CourseDetail(CourseID))

create table MarkDetail (  StudentID   INTEGER FOREIGN KEY
REFERENCES  StudentDetail(StudentID),
Mark INTEGER,
GradeID   INTEGER FOREIGN KEY
REFERENCES  GradeDetail(GradeID) )

Relationship Diagram:


0 comments:

Post a Comment

Blogger news