- A table for students;
- A table for groups;
- A table for teachers;
- A table for subjects with a reference to the teacher responsible for the subject;
- A table for student grades, specifying the date the grade was received.
For this homework, we will use a PostgreSQL database. Run the following command to start a Docker container:
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres
Replace some-postgres
with your container name and mysecretpassword
with your
custom password for connecting to the database.
- Students table;
- Groups table;
- Teachers table;
- Subjects table (with a reference to the teacher);
- Grades table (where each student has grades for subjects, with a date for each grade).
- ~30–50 students;
- 3 groups;
- 5–8 subjects;
- 3–5 teachers;
- Up to 20 grades for each student across all subjects.
Use the Faker
package for generating random data.
Populate the database using SQLAlchemy sessions.
- Find the top 5 students with the highest average grade across all subjects.
- Find the student with the highest average grade in a specific subject.
- Find the average grade for groups in a specific subject.
- Find the overall average grade across all grades.
- Find the courses taught by a specific teacher.
- Get the list of students in a specific group.**
- Get the grades of students in a specific group for a specific subject.**
- Find the average grade given by a specific teacher across their subjects.**
- Get the list of courses attended by a specific student.**
- List the courses taught to a specific student by a specific teacher.**
Для запитів оформити окремий файл my_select.py
, де будуть 10 функцій від
select_1
до select_10
. При запитах використовуємо механізм сесій SQLAlchemy
.