2

enter image description here

Here I have a table, I would like to query the average salary of departments, the SQL statement should be

select dept_name, avg(salary) from employee

I try to express this SQL in relational algebra. My assumption is as follows.

You can see that dept_name is not wrapped by an aggregation function, which is not following the standard.

enter image description here

  1. Is my expression correct?

  2. What is the right way to express the combination of aggregation and projection?

Reference

https://en.wikipedia.org/wiki/Relational_algebra#Aggregation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.