How would I find the highest/largest of something with relation algebra, domain relational calculus and tuple relational calculus

StackOverflow https://stackoverflow.com/questions/2429131

Question

This is part of a homework assignment. I've got several questions asking find the eid of the employee with the highest salary, or 2nd highest salary. Find the pilot that is certified for the most aircrafts. I don't have any idea on how to do it. There aren't any examples in the chapter, and google is proving less that helpful. If someone could show me how to do just one of these, it'll help a lot.

here are the tables:


Aircraft( aid: integer, aname: string, cruisingrange: integer )

Certified( eid: integer, aid: integer )

Employees( eid: integer, ename: string, salary: int )


Was it helpful?

Solution

I can give you an hint in how to obtain max and min values:

think about the fact that you can join an entity over itself, now think what join criteria you could use.. and then you can use the result of the join to subtract results from your initial set of elements

EDIT: what happens if you join employers with them selves with a criteria of having first salary <= second salary?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top