edited by
3,687 views
16 votes
16 votes
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)$ to find the list of names which appear more than once in examinee.
edited by

2 Answers

Best answer
20 votes
20 votes
$\pi_{\text{exm1.name}}(σ_{(\text{exm1.regno} \neq \text{examinee.regno}) \wedge (\text{emp1.name} = \text{emp2.name}) })(ρ _{\text{exm1}}(\text{examinee}) \times  \text{examinee}) $
edited by
1 votes
1 votes

1) $\Pi_{name}\left ( \sigma _{count(cnt)>1}\left ( _{name}g_{count(regno)\ as \ cnt}\left ( examinee \right ) \right ) \right )$

2) $SELECT_{regno}FROM\;examinee\; HAVING\;(score>avg(score))$

$\Pi _{regno}\left ( \sigma _{score>avg(score)}\left ( examinee \right ) \right )$

3) $SELECT_{centr\_code}FROM\;examinee\;join\;appears WHERE\;(score>80)$

$\Pi _{center\_code}\left ( \sigma _{score>80}\left ( examinee\Join appears \right ) \right )$

edited by

Related questions

7 votes
7 votes
3 answers
1
go_editor asked Feb 8, 2018
1,987 views
Consider a relation examinee (regno, name, score), where regno is the primary key to score is a real number.Write an SQL query to list the regno of examinees who have a s...