SQL & Queries


Answer & solution
Answer: SELECT regno FROM examinee WHERE score > (SELECT AVG(score) FROM examinee); (no official key was published)
Use an uncorrelated scalar subquery to compute one average over all examinees:
SELECT e.regno
FROM examinee AS e
WHERE e.score > (SELECT AVG(x.score) FROM examinee AS x);
The outer query compares each score with the same global average. Strict > excludes scores exactly equal to that average. No GROUP BY is needed because the intended comparison is to the whole relation, not a separate average per person or centre. The primary key ensures no duplicate registration number in the result. In SQL, AVG ignores NULL scores and comparison with NULL is unknown, so NULL-score rows do not qualify; the stated mathematical real-number model normally excludes this extra case.