Write a query in SQL to list the employees of grade 3 and 4 working in the department of FINANCE or AUDIT and whose salary is more than the salary of ADELYN
- برمجة سي كيو ال sql
- 2021-09-07
- mhanasmh00489829403
الأجوبة
SELECT *
FROM employees e
WHERE e.dep_id IN
(SELECT d.dep_id
FROM department d
WHERE d.dep_name IN ('FINANCE',
'AUDIT') )
AND e.salary >
(SELECT salary
FROM employees
WHERE emp_name = 'ADELYN')
AND e.hire_date <
(SELECT hire_date
FROM employees
WHERE emp_name = 'FRANK')
AND e.emp_id IN
(SELECT e.emp_id
FROM employees e,
salary_grade s
WHERE e.salary BETWEEN s.min_sal AND s.max_sal
AND s.grade IN (3,
4) )
ORDER BY e.hire_date ASC;
Sample Output:
emp_id | emp_name | job_name | manager_id | hire_date | salary | commission | dep_id --------+----------+----------+------------+------------+---------+------------+-------- 65646 | JONAS | MANAGER | 68319 | 1991-04-02 | 2957.00 | | 2001 67832 | CLARE | MANAGER | 68319 | 1991-06-09 | 2550.00 | | 1001 (2 rows)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال