Creating PostgreSQL Databases
Darryl Reeves
Industry Assistant Professor, New York University
Requirements
PRIMARY KEY
id | name | teacher | num |
---|---|---|---|
157 | Algebra | Maggie Winters | 244 |
162 | Physics | Maggie Winters | 244 |
321 | Spanish I | Jeremy Smith | 309 |
497 | History I | Sarah Williams | 313 |
613 | Spanish II | Jeremy Smith | 309 |
id | name | teacher | num |
---|---|---|---|
157 | Algebra | Maggie Winters | 244 |
162 | Physics | Maggie Winters | 244 |
321 | Spanish I | Jeremy Smith | 309 |
497 | History I | Sarah Williams | 313 |
613 | Spanish II | Jeremy Smith | 309 |
id | name | teacher | num |
---|---|---|---|
157 | Algebra | Maggie Winters | 244 |
162 | Physics | Maggie Winters | 244 |
321 | Spanish I | Jeremy Smith | 309 |
497 | History I | Sarah Williams | 313 |
613 | Spanish II | Jeremy Smith | 309 |
id | name | teacher | num |
---|---|---|---|
157 | Algebra | Maggie Winters | 244 |
162 | Physics | Maggie Winters | 244 |
321 | Spanish I | Jeremy Smith | 309 |
497 | History I | Sarah Williams | 313 |
613 | Spanish II | Jeremy Smith | 309 |
id | name | teacher | num |
---|---|---|---|
157 | Algebra | Maggie Winters | 244 |
162 | Physics | Maggie Winters | 244 |
321 | Spanish I | Jeremy Smith | 309 |
497 | History I | Sarah Williams | 313 |
613 | Spanish II | Jeremy Smith | 309 |
How do we change the structure of our data in order to alleviate these potential problems?
teacher
table
id | name | room_num |
---|---|---|
1 | Maggie Winters | 244 |
2 | Jeremy Smith | 309 |
3 | Sarah Williams | 313 |
teacher
table
id | name | room_num |
---|---|---|
1 | Maggie Winters | 244 |
2 | Jeremy Smith | 309 |
3 | Sarah Williams | 313 |
course_assignment
table
id | name | teacher_id |
---|---|---|
157 | Algebra | 1 |
162 | Physics | 1 |
321 | Spanish I | 2 |
497 | History I | 3 |
613 | Spanish II | 2 |
Creating PostgreSQL Databases