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. Databases gatecse-2001 databases sql normal descriptive + – Kathleen asked Sep 14, 2014 • edited Feb 8, 2018 by go_editor Kathleen 3.9k views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply Rishav Kumar Singh commented Dec 21, 2018 reply Follow Share Can anyone please post SQL query for this? 0 votes 0 votes Shaik Masthan commented Dec 22, 2018 reply Follow Share equivalent SQL query :- select e1.name from examine e1 where exist ( select * from examine e2 where e1.regno ≠ e2.regno and e1.name = e2.name ); 6 votes 6 votes Rishav Kumar Singh commented Dec 22, 2018 reply Follow Share Thank you 0 votes 0 votes Please log in or register to add a comment.
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}) $ Tauhin Gangwar answered Mar 29, 2016 • edited Jun 28, 2018 by Arjun Tauhin Gangwar comment Share Follow See all 9 Comments See all 9 9 Comments reply Show 6 previous comments neeraj_bhatt commented Nov 17, 2019 reply Follow Share @Devesh_Kumar The query is designed only to select the tuples where registration numbers are not same, but name is same. So, it'll obviously give correct result for two different persons with same name. 0 votes 0 votes anchitjindal07 commented Dec 15, 2019 reply Follow Share What is emp1 and emp2 in ur answer 1 votes 1 votes rajashish commented Dec 20, 2019 reply Follow Share Hi @Ayush Upadhyaya@Shaik Masthan How above RA will ensure that two person having same name appear more than once in examination? 0 votes 0 votes Please log in or register to add a comment.
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 )$ Sheshang answered Aug 17, 2016 • edited Apr 16, 2017 by Sheshang Sheshang comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Manu Thakur commented Oct 25, 2017 reply Follow Share Having can't be used without group by, this way in the second query. 4 votes 4 votes HeadShot commented Dec 20, 2018 reply Follow Share @Sheshang I dont think so standard relational algebra allows aggregate functions. 0 votes 0 votes HeadShot commented Dec 20, 2018 reply Follow Share 2. 4 votes 4 votes Please log in or register to add a comment.