Skip to content

Commit ab31abb

Browse files
authored
Create # 56
1 parent 39c9068 commit ab31abb

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

w3resource/# 56

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# 56. From the following table, write a SQL query to find those employees who get a commission percent and works as a SALESMAN and earn maximum net salary. Return department ID, name, designation, salary, and net salary (salary+ commission).
2+
3+
emp_id | emp_name | job_name | manager_id | hire_date | salary | commission | dep_id
4+
--------+----------+-----------+------------+------------+---------+------------+--------
5+
68319 | KAYLING | PRESIDENT | | 1991-11-18 | 6000.00 | | 1001
6+
66928 | BLAZE | MANAGER | 68319 | 1991-05-01 | 2750.00 | | 3001
7+
67832 | CLARE | MANAGER | 68319 | 1991-06-09 | 2550.00 | | 1001
8+
65646 | JONAS | MANAGER | 68319 | 1991-04-02 | 2957.00 | | 2001
9+
67858 | SCARLET | ANALYST | 65646 | 1997-04-19 | 3100.00 | | 2001
10+
69062 | FRANK | ANALYST | 65646 | 1991-12-03 | 3100.00 | | 2001
11+
63679 | SANDRINE | CLERK | 69062 | 1990-12-18 | 900.00 | | 2001
12+
64989 | ADELYN | SALESMAN | 66928 | 1991-02-20 | 1700.00 | 400.00 | 3001
13+
65271 | WADE | SALESMAN | 66928 | 1991-02-22 | 1350.00 | 600.00 | 3001
14+
66564 | MADDEN | SALESMAN | 66928 | 1991-09-28 | 1350.00 | 1500.00 | 3001
15+
68454 | TUCKER | SALESMAN | 66928 | 1991-09-08 | 1600.00 | 0.00 | 3001
16+
68736 | ADNRES | CLERK | 67858 | 1997-05-23 | 1200.00 | | 2001
17+
69000 | JULIUS | CLERK | 66928 | 1991-12-03 | 1050.00 | | 3001
18+
69324 | MARKER | CLERK | 67832 | 1992-01-23 | 1400.00 | | 1001
19+
(14 rows)
20+
21+
SELECT dep_id,
22+
emp_name,
23+
job_name,
24+
salary,
25+
salary+commission "Net Salary"
26+
FROM employees
27+
WHERE job_name = 'SALESMAN'
28+
AND salary+commission IN
29+
(SELECT max(salary+commission)
30+
FROM employees
31+
WHERE commission IS NOT NULL);

0 commit comments

Comments
 (0)