Company: flipkart-grid-8.0
Difficulty: medium
Consider the five tables dept , emp , designation , compensation and emp_dept described below. The employer wants to know the second-highest salary paid to an employee in the month of January 2021 . Write a query to get emp_no , first_name , last_name , gender , dept_no , dept_name and the salary credited in January 2021. Note: table names and column names must be used in exactly the case given in the question while writing SQL queries, otherwise it will create a syntax error. Schema emp emp_no INT(11) dob DATE first_name VARCHAR(14) last_name VARCHAR(16) gender VARCHAR(8) joining_date DATE dept dept_no CHAR(4) dept_name VARCHAR(40) emp_dept emp_no INT(11) dept_no CHAR(4) from_date DATE to_date DATE ( NULL for the employee's current department) compensation emp_no INT(11) credited_date DATE amount INT(11) designation emp_no INT(11) designation VARCHAR(50) from_date DATE to_date DATE What exactly to return Consider only compensation rows whose credited_date falls in January 2021 (from 2