How would I find the highest/largest of something

2019-08-17 03:42发布

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条回答
放我归山
2楼-- · 2019-08-17 04:11

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?

查看更多
登录 后发表回答