I have the following table:
create table prof_est(id_est int, id_prof int, id_curso int, periodo varchar);
id_est corresponds to the student id id_prof is the identification of the teacher who is dictating the subject id_curso is the identification of the course you are taking and finally period corresponds to the year and semester that the student is taking said course with said professor
The question asks me to generate a list that shows the id of students who have always taken more than 2 subjects per period. The information in the table is next .
This means that I should only return the ID of 203 because only this one complies with having taken more than 2 subjects in each period (It only appears in one period), the id of 201 should not appear because it has a period in the who has not fulfilled the condition.
I have this query for the time being
select id_est, periodo, count(periodo) as materias from prof_est
group by id_est, periodo
the table that the query sends me is here what the table shows corresponds to the id of the student, the period in which he has been, and the number of subjects he has taken in that period.
What I am looking for is only the id's of the students that in all the periods they have taken, have taken more than 2 subjects (which would only be the case of 203), as explained before, 201 would not be shown, since There is a period in which he has only taken 1 subject.