62 62 votes Given the relations employee (name, salary, dept-no), and department (dept-no, dept-name,address), Which of the following queries cannot be expressed using the basic relational algebra operations $\left(\sigma, \pi,\times ,\Join, \cup, \cap,-\right)$? Department address of every employee Employees whose name is the same as their department name The sum of all employees' salaries All employees of a given department Databases gatecse-2000 databases relational-algebra easy isro2016 + – Kathleen 22.7k views answer comment Share Follow Print See all 6 Comments 6 6 Comments reply Show 3 previous comments Deepak Poonia commented Aug 28, 2024 reply Follow flag @BharatKumar, Basic Relational Algebra doesn't have the concept of NULL values. So, using NULL values itself is part of Extended Relational Algebra. See HERE.Detailed Video Solution: https://www.youtube.com/watch?v=h3pJZbed9M8&t=2082s 3 3 replyShare js__ commented Sep 20, 2025 reply Follow flag Aggregate functions are not supported by relational algebra example sum,avg, max,min,count.(c) 1 1 replyShare Harshith_7 commented Jul 17 reply Follow flag Doubt:in option A,we have to get dept address of EVERY employee but if dept-no(in employee) is null then will not get their "department address" ?? dept no in employee is Foriegn key => it can be null 0 0 replyShare Please log in or register to add a comment.
Best answer 72 72 votes Possible solutions, relational algebra: (a) Join relation using attribute dpart_no. $\Pi_{\text{address}} (\text{emp} \bowtie \text{depart})$ OR $\Pi_{\text{address}} (\sigma_{ \text{emp}.\text{depart_no.}=\text{depart}.\text{depart_no}.} (\text{emp} \times \text{depart}))$ (b) $\Pi_{\text{name} } (\sigma_{\text{emp}.\text{depart_no.}=\text{depart}.\text{depart_no.} \wedge \text{emp.name} = \text{depart}.\text{depart_name}} (\text{emp} \times \text{depart}))$ OR $\Pi_{\text{name}} (\text{emp} \bowtie _{ \text{ emp.name} = \text{depart}.\text{depart_name}} \text{depart})$ (d) Let the given department number be $x$ $\Pi_{\text{name}} (\sigma_{ \text{emp}.\text{depart_no.}=\text{depart}.\text{depart_no.} \wedge \text{depart_no.} = x} (\text{emp} \times \text{depart}))$ OR $\Pi_{\text{name}} (\text{emp} \bowtie _{\text{ depart_no}.=x} \text{depart}) $ (c) We cannot generate relational algebra of aggregate functions using basic operations. We need extended operations here. Option (c). Mithlesh Upadhyay answered Apr 24, 2015 • edited Jun 28, 2018 by Arjun Mithlesh Upadhyay comment Share Follow See all 10 Comments 10 10 Comments reply Show 7 previous comments Mani_Raushan commented Jul 28, 2025 reply Follow flag @Arjun sir In option C, why are we doing a natural join of the EMP. and DEPT. tables? In the EMP table, E.name and D.no are both there, so directly we can use the EMP table only. 1 1 replyShare amanbadone0 commented Sep 19, 2025 reply Follow flag @Mani_Raushan I think you meant in option D, also your doubt makes sense i think we should be able to do it without Department relation, i.e.project employee.name (select employee where employee.dept_no = give_dept_no)[NOTE : the above query is just a logical description of what a corresponding relational expression look like and not a sql query kind of thing]correct me if i am wrong 0 0 replyShare Ysh 1 commented Sep 4 reply Follow flag Why are we assuming name as candidate key? We should use projection of all attributes for options b and d cuz employee name is not asked 0 0 replyShare Please log in or register to add a comment.
21 21 votes aggregate functions are not supported by relational algebra ie. sum,average,maximum,minimum and count.So c is the answer shikhar_deep05 answered Aug 26, 2016 shikhar_deep05 comment Share Follow See all 7 Comments 7 7 Comments reply Show 4 previous comments suvasish pal commented Sep 12, 2017 reply Follow flag @ashutoshaay26 what's the output of this query? 0 0 replyShare ashutoshaay26 commented Sep 13, 2017 reply Follow flag Minimum of table 1 of an attribute c. 1 1 replyShare Venky8 commented May 6, 2021 reply Follow flag For anyone wondering how min, max can be found out by RA with basic operations. See https://stackoverflow.com/questions/5493691/how-can-i-find-max-with-relational-algebra. But sum operation cannot be found out by RA by using just basic operations. 0 0 replyShare Please log in or register to add a comment.
0 0 votes in option c we need aggregate function but in relational algebra there is no any aggregate function thats why it is impossible to express SWAYANSHUSHEKHER answered Mar 18 SWAYANSHUSHEKHER comment Share Follow 0 reply Please log in or register to add a comment.
–5 –5 votes (b) we need to do a self join, for which we need rename operator(row symbol) Aravind answered Sep 25, 2014 Aravind comment Share Follow See all 3 Comments 3 3 Comments reply Arjun commented Sep 25, 2014 reply Follow flag what about sum? 0 0 replyShare Aravind commented Sep 26, 2014 i edited by Aravind Sep 26, 2014 reply Follow flag i think with select operator we can calculate sum and sum is not a relation operator Where can i find the keys of all gate paper ? 0 0 replyShare Arjun commented Sep 26, 2014 reply Follow flag No. sum is an aggregate operator. Simply with select, this cannot be done. Only keys from 2012 are published. Before that many people have given keys, but they may not be authentic. You can do a google search for this. For 2012-14 you can see here: http://gatecse.in/wiki/Previous_Year_GATE_Question_Papers_and_Keys 6 6 replyShare Please log in or register to add a comment.