Write an SQL query based on aggregate functions, wildcard operators, and joins.
Use the provided school, student, registration, and exam tables. Include students whose last names begin with A% and exams whose titles begin with SAT%. Return only schools with at least two qualifying attempts.
Output
- One row per qualifying school with
school_code, school_name, eligible_students, exam_attempts, average_score, highest_score, and performance_rank
- Rank schools by average score descending, then highest score descending
- Sort by
performance_rank, then school_name