Write a query in SQL to list the department id, name, designation, salary and net salary (salary+commission) of the employees only who gets a commission and earn the second highest earnings (salary + commission)
- برمجة سي كيو ال sql
- 2021-09-07
- mhanasmh00489829403
الأجوبة
SELECT dep_id,
emp_name,
salary,
job_name,
salary+commission "Net Salary"
FROM employees e
WHERE 2-1 = (
SELECT count(DISTINCT emp.salary+emp.commission)
FROM employees emp WHERE emp.salary+emp.commission>e.salary+e.commission);
Sample Output:
dep_id | emp_name | salary | job_name | Net Salary --------+----------+---------+----------+------------ 3001 | ADELYN | 1700.00 | SALESMAN | 2100.00 (1 row)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال