0% found this document useful (0 votes)
8 views1 page

SQL Database Schema for Education System

The document outlines the SQL schema for a database consisting of five tables: Student, Enrollment, Course, Instructor, and Department. Each table includes various fields with specified data types and constraints, such as primary keys and foreign keys for establishing relationships between the tables. The schema is designed to manage student enrollment in courses, instructor details, and departmental information.

Uploaded by

Engineering
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

SQL Database Schema for Education System

The document outlines the SQL schema for a database consisting of five tables: Student, Enrollment, Course, Instructor, and Department. Each table includes various fields with specified data types and constraints, such as primary keys and foreign keys for establishing relationships between the tables. The schema is designed to manage student enrollment in courses, instructor details, and departmental information.

Uploaded by

Engineering
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

-- Student table

CREATE TABLE Student (


StudentID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(100) NOT NULL,
DateOfBirth DATE NOT NULL,
Address VARCHAR(200),
Nationality VARCHAR(50),
StudentStatus VARCHAR(50)
);

-- Enrollment table
CREATE TABLE Enrollment (
EnrollmentID INT PRIMARY KEY AUTO_INCREMENT,
DateEnrolled DATE NOT NULL,
FinalGrade VARCHAR(20),
StudentID INT NOT NULL,
CourseID INT NOT NULL,
FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
FOREIGN KEY (CourseID) REFERENCES Course(CourseID)
);

-- Course table
CREATE TABLE Course (
CourseID INT PRIMARY KEY AUTO_INCREMENT,
CourseName VARCHAR(100) NOT NULL,
Credits INT NOT NULL,
DepartmentID INT NOT NULL,
InstructorID INT NOT NULL,
FOREIGN KEY (DepartmentID) REFERENCES Department(DepartmentID),
FOREIGN KEY (InstructorID) REFERENCES Instructor(InstructorID)
);

-- Instructor table
CREATE TABLE Instructor (
InstructorID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(100) NOT NULL,
Address VARCHAR(200),
DateOfBirth DATE NOT NULL,
Specialty VARCHAR(100),
DepartmentID INT NOT NULL,
FOREIGN KEY (DepartmentID) REFERENCES Department(DepartmentID)
);

-- Department table
CREATE TABLE Department (
DepartmentID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(100) NOT NULL,
Building VARCHAR(100),
HeadOfDepartment VARCHAR(100),
Field VARCHAR(100)
);

You might also like