You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 lines
306 B
SQL

/*23. Write a query in SQL to display job ID, number of employees, sum of salary,
and difference between highest salary and lowest salary for a job.*/
SELECT job_id, COUNT(*), SUM(salary),
MAX(salary)-MIN(salary) AS salary_difference
FROM employees
GROUP BY job_id;