forked from dimitri-yatsenko/db-programming-with-datajoint
-
Notifications
You must be signed in to change notification settings - Fork 4
/
university.py
98 lines (85 loc) · 2.07 KB
/
university.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import datajoint as dj
schema = dj.schema('dimitri_university')
@schema
class Student(dj.Manual):
definition = """
student_id : int unsigned # university-wide ID number
---
first_name : varchar(40)
last_name : varchar(40)
sex : enum('F', 'M', 'U')
date_of_birth : date
home_address : varchar(120) # mailing street address
home_city : varchar(60) # mailing address
home_state : char(2) # US state acronym: e.g. OH
home_zip : char(10) # zipcode e.g. 93979-4979
home_phone : varchar(20) # e.g. 414.657.6883x0881
"""
@schema
class Department(dj.Manual):
definition = """
dept : varchar(6) # abbreviated department name, e.g. BIOL
---
dept_name : varchar(200) # full department name
dept_address : varchar(200) # mailing address
dept_phone : varchar(20)
"""
@schema
class StudentMajor(dj.Manual):
definition = """
-> Student
---
-> Department
declare_date : date # when student declared her major
"""
@schema
class Course(dj.Manual):
definition = """
-> Department
course : int unsigned # course number, e.g. 1010
---
course_name : varchar(200) # e.g. "Neurobiology of Sensation and Movement."
credits : decimal(3,1) # number of credits earned by completing the course
"""
@schema
class Term(dj.Manual):
definition = """
term_year : year
term : enum('Spring', 'Summer', 'Fall')
"""
@schema
class Section(dj.Manual):
definition = """
-> Course
-> Term
section : char(1)
---
auditorium : varchar(12)
"""
@schema
class CurrentTerm(dj.Manual):
definition = """
omega : enum('1') # surrogate
---
-> Term
"""
@schema
class Enroll(dj.Manual):
definition = """
-> Student
-> Section
"""
@schema
class LetterGrade(dj.Manual):
definition = """
grade : char(2)
---
points : decimal(3,2)
"""
@schema
class Grade(dj.Manual):
definition = """
-> Enroll
---
-> LetterGrade
"""