Given the relations employee(name, salary, deptno) and department(deptno,…

2000

Given the relations

employee(name, salary, deptno) and
department(deptno, deptname, address)

Which of the following queries cannot be expressed using only the basic relational algebra operations: union (∪), set difference (−), Cartesian product (×), projection (π), selection (σ), and renaming (ρ)?

Answer: C. The sum of all employees’ salariesThe correct answer is: The sum of all employees' salaries. The listed operations are the basic relational algebra operations: union, set difference, Cartesian…

  1. A.

    Department address of every employee

  2. B.

    Employees whose name is the same as their department name

  3. C.

    The sum of all employees’ salaries

  4. D.

    All employees of a given department

Attempted by 274 students.

Show answer & explanation

Correct answer: C

The correct answer is: The sum of all employees' salaries.

The listed operations are the basic relational algebra operations: union, set difference, Cartesian product, projection, selection, and renaming. These operations can filter rows, combine relations, rename attributes, and project selected columns.

Option A is expressible by joining employee and department on deptno and projecting address.

Option B is expressible by combining the two relations and selecting rows where employee.name = department.deptname.

Option D is expressible by selecting the required department from employee, or by joining with department and then applying the required condition.

However, option C requires computing SUM(salary). Aggregation functions such as SUM, COUNT, AVG, MIN, and MAX are not part of basic relational algebra.

Therefore, the query asking for the sum of all employees' salaries cannot be expressed using only the listed basic relational algebra operations.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…