I have constructed this SQL query:
SELECT DISTINCT a.uid, a.sid, a.fname, a.lname, b.class_code from student a, class b where b.grade_code = '2' and a.class = b.class_code and a.school_code = 'SES' order by a.class, a.lname, a.fname
My attempt is to pick up all students in grade 2 for school SES. The grade field is not contained in the student table, rather the class field links to class_code in the class table.
The attached files are (File1), content of table class for all grade 2 classes, (File2) all students who are in grade 2 classes, (File3), partial result.
File4 is the structure of table student. File 5 is the structure of table class.
Note that class 31 in in grade 3, not grade 2.