Write a query in SQL to list the employee ID, name, salary, department name of all the 'MANAGERS' and 'ANALYST' working in SYDNEY, PERTH
- برمجة سي كيو ال sql
- 2021-09-07
- mhanasmh00489829403
الأجوبة
SELECT e.emp_id,
e.emp_name,
e.salary,
d.dep_name
FROM employees e,
department d
WHERE d.dep_location IN ('SYDNEY',
'PERTH')
AND e.dep_id = d.dep_id
AND e.emp_id IN
(SELECT e.emp_id
FROM employees e
WHERE e.job_name IN ('MANAGER',
'ANALYST')
AND (DATE_PART('year', CURRENT_DATE)-DATE_PART('year', hire_date))> 5
AND e.commission IS NULL)
ORDER BY d.dep_location ASC;
Sample Output:
emp_id | emp_name | salary | dep_name --------+----------+---------+----------- 66928 | BLAZE | 2750.00 | MARKETING 67832 | CLARE | 2550.00 | FINANCE (2 rows)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال