0

So I am having a bit of trouble understanding the Grouping operator, Ɣ. If had a the relation Sales(employeeId, date, salePrice) and I wanted to list the largest salePrice for each employee per day, how would I group both by employeeId and date?

For example would it be
ƔemployeeId,date,MAX(salePrice)->largestSale(Sales)
or
ƔemployeeId,date; MAX(salePrice)->largestSale(Sales)
or something along those lines?

1

The usual notation is to write separately the grouping attributes from the aggregation functions, writing the attributes on the left of the γ symbol and the aggregation functions on the right, so your query should be something like this:

employeeId, date γ MAX(salePrice)→ largetSale(Sales)

This means:

  1. make a group for each different combination of employeeId and date in the Sales relation, and

  2. for each group produce a tuple with employeeId, date, maximum sale price of the group.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.