Write a query in SQL to display the employee ID, name, salary, department name, location, department ID, job name of all the employees working at SYDNEY or working in the FINANCE deparment with an annual salary above 28000
- برمجة سي كيو ال sql
- 2021-09-07
- mhanasmh00489829403
الأجوبة
SELECT E.emp_id,
E.emp_name,
E.salary,
D.dep_name,
D.dep_location,
E.dep_id,
E.job_name
FROM employees E,
department D
WHERE (D.dep_location = 'SYDNEY'
OR D.dep_name = 'FINANCE')
AND E.dep_id=D.dep_id
AND E.emp_id IN
(SELECT emp_id
FROM employees E
WHERE (12*E.salary) > 28000
AND E.salary NOT IN (3000,
2800)
AND E.job_name !='MANAGER'
AND (trim(to_char(emp_id,'99999')) LIKE '__3%'
OR trim(to_char(emp_id,'99999')) LIKE '__7%'))
ORDER BY E.dep_id ASC,
E.job_name DESC;
Sample Output:
emp_id | emp_name | salary | dep_name | dep_location | dep_id | job_name --------+----------+---------+----------+--------------+--------+----------- 68319 | KAYLING | 6000.00 | FINANCE | SYDNEY | 1001 | PRESIDENT (1 row)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال