The bank was created as follows:
- Each Discipline can have 1 or more classes, while each Class belongs to only 1 Discipline.
- Each Teacher can have 1 or more classes, while each Class belongs to only 1 teacher.
- Each student may be enrolled in 1 or more classes, while a class may have 1 or more students.
- Each student has 2 grades per class in which he / she is enrolled.
I need to create a page (using the PHP language) that queries the database and shows the following information:
- Which teacher has more male students ('m')
- Which teacher has more female students ('f')
- Which class has the highest overall average
- Which class has the highest individual average (only 1 student)
- Which class has the lowest overall average
- Which class has the lowest individual average (only 1 student)
- List the code of each class with the following information associated with it: the general average (of all marks), the name of the student with the lowest mean, the name of the student with the highest average.
I am wondering how to generate this query in DB and if I can create a variable for one of them?