Given the relations
Which of the following queries cannot be expressed using the basic relational algebra operations $\left(\sigma, \pi,\times ,\Join, \cup, \cap,-\right)$?
Aggregate function: sum,average,max,min,count,count-distinct
syntax: ℱ<function-list> (R)
for this : ℱ sum salary (employee)
Possible solutions, relational algebra:
(a) Join relation using attribute dpart_no.
(b)
(d) Let the given department number be $x$
(c) We cannot generate relational algebra of aggregate functions using basic operations. We need extended operations here.
Option (c).
I think no need of join in option D as both employee name and dept_no is in same table.
This can be used instead: projection of name(selection on dept_no = x(emp))
2nd part of Ans(b) is wrong i.e the query written under OR. There should be another condition that is employee.dept-no=department.dept-no. Also in ans(d) if department no is given as x then we can find all employees of a given department using employee table only by selecting tuples where dept-no = x and then projecting name
@ashutoshaay26 what's the output of this query?
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.
64.3k questions
77.9k answers
244k comments
80.0k users