Barclays Interview Questions | Query II

Question

Take reference from the previous question,

Query I

In the same Table 3, find the employee with highest salary and arrange them in the alphabetical order of their last name.

in progress 0
Dhruv2301 55 years 3 Answers 1145 views Great Grand Master 0

Answers ( 3 )

  1. select table1.first_name, table1.last_name from table1 join table2 on table1.id=table2.id where table2.salary=(select max(table2.salary) from table2) order by table1.last_name;

  2. select first_name, last_name, max(salary)
    from table1 inner join table2 using(id)
    order by 2

  3. select T1.First_Name, T1.Last_Name, max(T2.salary)
    from Table1 T1 inner join Table2 T2
    on T1.id =T2.id
    Order by T1.Last_Name ;

Leave an answer

Browse
Browse