Tạo cơ sở dữ liệu PostgreSQL
Darryl Reeves
Industry Assistant Professor, New York University
Yêu cầu
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 |
(phụ thuộc bắc cầu)
| 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 |
Làm thế nào thay đổi cấu trúc dữ liệu để giảm các vấn đề này?
Bảng teacher
| id | name | room_num |
|---|---|---|
| 1 | Maggie Winters | 244 |
| 2 | Jeremy Smith | 309 |
| 3 | Sarah Williams | 313 |
Bảng teacher
| id | name | room_num |
|---|---|---|
| 1 | Maggie Winters | 244 |
| 2 | Jeremy Smith | 309 |
| 3 | Sarah Williams | 313 |
Bảng course_assignment
| id | name | teacher_id |
|---|---|---|
| 157 | Algebra | 1 |
| 162 | Physics | 1 |
| 321 | Spanish I | 2 |
| 497 | History I | 3 |
| 613 | Spanish II | 2 |
Tạo cơ sở dữ liệu PostgreSQL