You are given three tables: Students, Friends and Packages. Students contains two columns: ID and Name. Friends contains two columns: ID and Friend_ID (ID of the ONLY best friend). Packages contains two columns: ID and Salary (offered salary in $ thousands per month).
The Students table is described as follows:
| Column | Type |
|---|---|
| ID | Integer |
| Name | String |
The Friends table is described as follows:
| Column | Type |
|---|---|
| ID | Integer |
| Friend_ID | Integer |
The Packages table is described as follows:
| Column | Type |
|---|---|
| ID | Integer |
| Salary | Float |
Write a query to output the names of those students whose best friends got offered a higher salary than them. Names must be ordered by the salary amount offered to the best friends. It is guaranteed that no two students got same salary offer.