Hello. I sat down to deal with the structure of the database "students". It all started with an incomprehensible job from where it was taken without input for the database (the teacher said that it was easy to understand what to do and how to do it). The first thing that confused me was which structure to choose for the following points:
- find the average grade for each student;
- find the maximum grade for each discipline;
- find the average grade given by each teacher;
- withdraw the minimum grade given by each teacher;
- transfer each grade to a rating score (score, greater than 3 points, doubles);
- count the number of different groups;
- count the number of different apartments;
- display the average grade, maximum mark, minimum mark for student with code 3;
- count the number of good grades;
- calculate the percentage of twos for each teacher;
- display the number of estimates for which the condition is satisfied; "Score * 2 + 1> 10".
It became interesting from the very beginning: guess about the input data itself + tasks, apparently, were translated into a translator ("number of apartments").
I decided to create a database of the following structure:
- There will be exactly 5 tables: "students", "groups", "teachers", "disciplines", "marks";
- "Student - Group" links - "many to one"; "teacher - assessment" - "one to many"; "student - discipline" - "many to many"; the table "marks" connects students and disciplines, teachers and disciplines (a teacher can lead several disciplines, and one discipline can be taught by several teachers), one and the same teacher can lead to several students (students of different groups);
Here begins the most interesting. I deal with MySQL not for long (1 lab on the operator "SELECT"). There were two tables in the database for one-to-many communication - everything is clear. First, how to choose the right entities for connections, then - I know that it is logical to choose "marks", "groups" with "students", "students" to link to "discipline" with a coherent table, but, in principle, you can create a connection and between the entities "teachers" and "disciplines directly as" disciplines "with" groups "and in general. Another question related to how I relate the existing structure to the audience, or rather to the existing structure, add an audience (apartment)), because if you create a table "auditorium" and associate with the assessment of the assessment, for example, in the table "marks" there will be a lot of unnecessary links, and this do not.
Please give an answer to the question with the correct choice of entities, and about which table should be entered and with which fields to create it, with which to link. Understand me, I'm not lazy and not stupid, although not for me to judge. The lecturer conducting labs himself works only after graduation, in general, you yourself understand that you have to figure it out yourself, and when the task is incomplete, which is what it is all about. Below I cite the structure that has been developed so far: 