Untitled
CREATE TABLE Students ( student_id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), birth_date DATE, address VARCHAR(100), phone VARCHAR(15) ); CREATE TABLE Courses ( course_id INT PRIMARY KEY, course_name VARCHAR(100), credit_points INT ); CREATE TABLE Lecturers ( lecturer_id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), department VARCHAR(100) ); CREATE TABLE Enrollment ( student_id INT, course_id INT, grade DECIMAL(3, 2), PRIMARY KEY (student_id, course_id), FOREIGN KEY (student_id) REFERENCES Students(student_id), FOREIGN KEY (course_id) REFERENCES Courses(course_id) ); CREATE TABLE Teaching ( lecturer_id INT, course_id INT, semester VARCHAR(10), PRIMARY KEY (lecturer_id, course_id, semester), FOREIGN KEY (lecturer_id) REFERENCES Lecturers(lecturer_id), FOREIGN KEY (course_id) REFERENCES Courses(course_id) );
Leave a Comment