Write a query in SQL to find out the employees whose salaries are greater than the salaries of their managers
- برمجة سي كيو ال sql
- 2021-09-07
- mhanasmh00489829403
الأجوبة
SELECT *
FROM employees e,
(SELECT *
FROM employees
WHERE emp_id IN
(SELECT manager_id
FROM employees)) a
WHERE e.salary >a.salary
AND e.manager_id = a.emp_id;
Sample Output:
emp_id | emp_name | job_name | manager_id | hire_date | salary | commission | dep_id | emp_id | emp_name | job_name | manager_id | hire_date | salary | commission| dep_id --------+----------+----------+------------+------------+---------+------------+--------+--------+----------+----------+------------+------------+---------+-----------+-------- 67858 | SCARLET | ANALYST | 65646 | 1997-04-19 | 3100.00 | | 2001 | 65646 | JONAS | MANAGER | 68319 | 1991-04-02 | 2957.00 | | 2001 69062 | FRANK | ANALYST | 65646 | 1991-12-03 | 3100.00 | | 2001 | 65646 | JONAS | MANAGER | 68319 | 1991-04-02 | 2957.00 | | 2001 (2 rows)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال