Write a query in SQL to list the name, salary, commission and netpay for those employees whose netpay is more than any other employee
- برمجة سي كيو ال sql
- 2021-09-07
- mhanasmh00489829403
الأجوبة
SELECT e.emp_name,
e.salary,
e.commission,
(SELECT sum(salary+commission)
FROM employees) NETPAY
FROM employees e
WHERE
(SELECT sum(salary+commission)
FROM employees) > ANY
(SELECT salary
FROM employees
WHERE emp_id =e.emp_id) ;
Sample Output:
emp_name | salary | commission | netpay ----------+---------+------------+--------- KAYLING | 6000.00 | | 8500.00 BLAZE | 2750.00 | | 8500.00 CLARE | 2550.00 | | 8500.00 JONAS | 2957.00 | | 8500.00 SCARLET | 3100.00 | | 8500.00 FRANK | 3100.00 | | 8500.00 SANDRINE | 900.00 | | 8500.00 ADELYN | 1700.00 | 400.00 | 8500.00 WADE | 1350.00 | 600.00 | 8500.00 MADDEN | 1350.00 | 1500.00 | 8500.00 TUCKER | 1600.00 | 0.00 | 8500.00 ADNRES | 1200.00 | | 8500.00 JULIUS | 1050.00 | | 8500.00 MARKER | 1400.00 | | 8500.00 (14 rows)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال