Q. Gopi Krishna is using a table Employee. It has the following columns:


Code, Name, Salary, Deptcode


He wants to display maximum salary department wise. He wrote the following command:


SELECT Deptcode, Max(Salary) FROM Employee ;


But he did not get the desired result.

Rewrite the above query with necessary changes to help him get the desired output.


Answer :-


SELECT Deptcode, Max(Salary)

FROM Employee

GROUP BY Dept Code;

4 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. What if we donot write dept code as column

    ReplyDelete
    Replies
    1. But Question say to group the data by deptcode.

      Delete
  2. i dont understand

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post