Question
Q) Find the instructor earning the second highest salary. (Dont use ORDER BY and LIMIT in your solution.) in MySQL here is the table I
Q) Find the instructor earning the second highest salary. (Dont use ORDER BY and LIMIT in your solution.) in MySQL here is the table I am using named Instructor with the following 4 attributes: Instructor(ID, name, dept_name, salary) ID is the primary key I am supposed to report the answer with the name, ID and salary of the second highest salaried instructor. I know how to do it if I only needed to report the second highest salary, but I am having trouble getting it with the corresponding name 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 without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'database.instructor.ID'; this is incompatible with sql_mode=only_full_group_by" Any help is appreciated!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started