0% found this document useful (0 votes)
18 views2 pages

New

The document creates tables for instructors, students, courses, assignments, and joins tables to relate students to courses and assignments. Primary and foreign keys are defined to link the tables.

Uploaded by

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

New

The document creates tables for instructors, students, courses, assignments, and joins tables to relate students to courses and assignments. Primary and foreign keys are defined to link the tables.

Uploaded by

api-529013966
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CREATE TABLE instructors (

instructor_id INT UNIQUE AUTO_INCREMENT,


name VARCHAR(45),
email VARCHAR(45),
password VARCHAR(45),
PRIMARY KEY (instructors_id)
);

CREATE TABLE students (


student_id INT UNIQUE AUTO_INCREMENT,
name VARCHAR(45),
email VARCHAR(45),
password VARCHAR(45),
PRIMARY KEY (instructors_id)
);

CREATE TABLE courses (


course_id INT UNIQUE AUTO_INCREMENT,
name VARCHAR(45),
instructor_id INT,
PRIMARY KEY (course_id),
FOREIGN KEY (instructor_id) REFERENCES instructors(instructor_id),

CREATE TABLE assignments (


assignment_id INT UNIQUE AUTO_INCREMENT,
name VARCHAR(45),
course_id INT,
due_date DATE,
max_score DECIMAL(100, 2),
PRIMARY KEY (assignment_id),
FOREIGN KEY (course_id) REFERENCES courses(course_id),

);

CREATE TABLE students_courses (


student_id INT,
course_id INT,
FOREIGN KEY (student_id) REFERENCES students(student_id),
FOREIGN KEY (course_id) REFERENCES courses(course_id)
);

CREATE TABLE students_courses (


student_id INT,
assignment_id INT,
score DECIMAL(100, 2),
FOREIGN KEY (student_id) REFERENCES students(student_id),
FOREIGN KEY (assignment_id) REFERENCES assignments(assignment_id)
);

You might also like