1SELECT * FROM students WHERE notes > ( SELECT AVG(notes) FROM students );
2
3SELECT * FROM students WHERE class_id = (
4 SELECT id FROM classes WHERE number_of_students = (
5 SELECT MAX(number_of_students) FROM classes
6 )
7);
8
9SELECT subject, MAX(salary_by_subject.avg_salary) AS max_salary
10FROM (
11 SELECT subject, AVG(monthly_salary) AS avg_salary
12 FROM teachers
13 GROUP BY subject
14) salary_by_subject;
1SELECT column_name [, column_name ]
2FROM table1 [, table2 ]
3WHERE column_name OPERATOR
4 (SELECT column_name [, column_name ]
5 FROM table1 [, table2 ]
6 [WHERE])