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

帅比萌擦擦* 提交于 2019-12-11 18:37:25

问题


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 )



回答1:


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?



来源:https://stackoverflow.com/questions/2429131/how-would-i-find-the-highest-largest-of-something-with-relation-algebra-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!