Solution with Detail Explanation ( Easy to Understand)
Please upvote to motivate me ^ Thanks\n\nHERE  if  N=2  THEN Second Highest salary will be Displayed\n\nFirst Select Column  by SELECT salary \nNow SELECT DISTI
**Please upvote to motivate me ^ Thanks**\n\nHERE  if  N=2  THEN Second Highest salary will be Displayed\n\nFirst Select Column  by SELECT salary \nNow SELECT DISTINCT salary because we don\'t want repeating value.\nArrange Salary in descending Order So we have Higest salary at TOP\nNow we Only one row as output SO  LIMIT 1\nNow  OFFSET it display N+1 row  Example. if n=2  then it will show Third Highest Salary Therefore N=N-1 is used.\n\n```\nCREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\nBEGIN\n\nSET N=N-1;\n\n  RETURN (\n      SELECT DISTINCT salary FROM Employee ORDER BY salary DESC \n      LIMIT 1 OFFSET N      \n  );\nEND\n\n```
['MySQL']