Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
876 B
1
Indexable
def create_tables():
    db.execute("CREATE TABLE teachers (id INTEGER PRIMARY KEY, name TEXT)")
    db.execute ("CREATE TABLE courses (id INTEGER PRIMARY KEY, name TEXT, credits INTEGER)")
    db.execute("CREATE TABLE cteachers (id INTEGER PRIMARY KEY, course_id INTEGER REFERENCES courses(id), teacher_id INTEGER REFERENCES teachers(id))")
    db.execute ("CREATE TABLE students (id INTEGER PRIMARY KEY, name TEXT)")
    db.execute ("CREATE TABLE grades (id INTEGER PRIMARY KEY, student_id INTEGER REFERENCES students(id), course_id INTEGER REFERENCES courses(id), date DATETIME, grade INTEGER,)")
    db.execute ("CREATE TABLE groups (id INTEGER PRIMARY KEY, name TEXT)")
    db.execute ("CREATE TABLE gusers (id INTEGER PRIMARY KEY, groups_id INTEGER REFERENCES groups, teacher_id INTEGER REFERENCES teachers(id), student_id INTEGER REFERENCES students(id))")