-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
40 lines (35 loc) · 910 Bytes
/
schema.sql
File metadata and controls
40 lines (35 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- This file makes the tables for our database
-- Deletes old tables so we can start fresh.
DROP TABLE IF EXISTS Enrollments;
DROP TABLE IF EXISTS Courses;
DROP TABLE IF EXISTS Students;
DROP TABLE IF EXISTS Professors;
-- Makes the Students table.
CREATE TABLE Students (
student_id INTEGER PRIMARY KEY,
first_name TEXT,
last_name TEXT,
email TEXT,
enrollment_date DATE
);
-- Makes the Professors table.
CREATE TABLE Professors (
professor_id INTEGER PRIMARY KEY,
first_name TEXT,
last_name TEXT,
department TEXT
);
-- Makes the Courses table.
CREATE TABLE Courses (
course_id INTEGER PRIMARY KEY,
course_name TEXT,
credits INTEGER,
professor_id INTEGER
);
-- Makes the Enrollments table to connect students and courses.
CREATE TABLE Enrollments (
enrollment_id INTEGER PRIMARY KEY,
student_id INTEGER,
course_id INTEGER,
grade TEXT
);