Q) Find the instructor earning the second highest salary. (Don’tuse ORDER BY and LIMIT in your solution.) in MySQL
here is the table I am using named Instructor with the following 4attributes:
Instructor(ID, name, dept_name, salary)
ID is the primary key
I am supposed to report the answer with the name, ID and salary ofthe second highest salaried instructor.
I know how to do it if I only needed to report the second highestsalary, but I am having trouble getting it with the correspondingname and id as well. This is what I am trying:
Select ID, name, max(salary) as salary
From instructor
Where salary < (select max(salary)
           From instructor);
but it is saying \"Error Code: 1140. In aggregated query withoutGROUP BY, expression #1 of SELECT list contains nonaggregatedcolumn 'database.instructor.ID'; this is incompatible withsql_mode=only_full_group_by\"
Any help is appreciated!