Computer Science
List the maximum salary of employee grouped by their department number.
SQL Joins & Grouping
1 Like
Answer
SELECT deptno, MAX(sal) AS max_salary
FROM EMPL
GROUP BY deptno;
Output
+--------+------------+
| deptno | max_salary |
+--------+------------+
| 20 | 3000 |
| 30 | 2850 |
| 10 | 5000 |
+--------+------------+
Answered By
3 Likes
Related Questions
List the count of employees grouped by deptno. (table EMPL)
List the sum of employees' salaries grouped by department. (table EMPL)
Below are the customer and order tables :
Customers
customer id (PK) first_name last_name email address city state zip Orders
order id (PK) order_date amount customer_id (FK) List the total of customers' orders grouped by customer (id).
Below are the customer and order tables :
Customers
customer id (PK) first_name last_name email address city state zip Orders
order id (PK) order_date amount customer_id (FK) List the sum of the totals of orders grouped by customer and state.