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.8k 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 Purple commented Jan 8, 2017 reply Follow Share Isn't the 2nd answer opposite to what the question is asking? 3 votes 3 votes bhuv commented Dec 27, 2017 reply Follow Share Those who are looking a query 1 with a :O face, the conditions are written for cross product beneath the 'X' symbol that is not a separate line. Also please someone confirms if 'σ" is needed there while writing conditions, I don't think so that it was needed. Instead of the cross product, we can use condition join with same conditions. 0 votes 0 votes Ayush Upadhyaya commented Dec 29, 2017 reply Follow Share IN clause in oracle has a limit of maximum 1000 values that can be compared at a time. In that case, query using natural join can help 3 votes 3 votes srestha commented Jul 8, 2018 reply Follow Share We also can write it as Select name from Examinee where not exists (Select distinct name from Examinee); 0 votes 0 votes Rishav Kumar Singh commented Dec 21, 2018 reply Follow Share What is emp2 ? It should be examinee.name 2 votes 2 votes Devesh_Kumar commented Nov 16, 2019 reply Follow Share Will it give correct result for two different person with same name and different registration number. 1 votes 1 votes 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. 3 votes 3 votes Please log in or register to add a comment.