1,987 views

3 Answers

Best answer
12 votes
12 votes

There are many ways to write a query, all of which will perform the same task. One way is:

SELECT regno
FROM examinee
WHERE score > (SELECT AVG(score)
               FROM examinee )

Here, the inner query is returning the average of the scores. And outer query selects those regno that have a score greater than this average.

selected by
0 votes
0 votes
SELECT regno

FROM examinee as E

WHERE E.score >(SELECT avg(score)

                                  FROM E)
–2 votes
–2 votes
SELECT regno
FROM examinee
HAVING score > avg(score)

Related questions

16 votes
16 votes
2 answers
2
Kathleen asked Sep 14, 2014
3,690 views
Consider a relation examinee (regno, name, score), where regno is the primary key to score is a real number.Write a relational algebra using $( \Pi, \sigma, \rho, \times)...