Skip to content

Instantly share code, notes, and snippets.

@theabhayprajapati
Last active September 23, 2022 15:22
Show Gist options
  • Save theabhayprajapati/164cebddcced27abe667761e250b24a0 to your computer and use it in GitHub Desktop.
Save theabhayprajapati/164cebddcced27abe667761e250b24a0 to your computer and use it in GitHub Desktop.
select d.DeptName, Min(salary) "Minimum Salary", Max(Salary) "Maximum Salary" from employee e, department d where e.DeptId=d.DeptId group by e.deptId;
SELECT Desgn, COUNT(Desgn) FROM Employee GROUP BY Desgn;
SELECT Desgn, MIN(Salary), MAX(Salary), SUM(Salary), AVG(Salary) FROM Employee GROUP BY Desgn;
SELECT MAX(Salary) - MIN(Salary) AS 'Range of Salary' FROM Employee;
select m.Empno "Manager ID", e.Salary "Minimum Salary" from Employee m, Employee e where e.DeptId=m.DeptId AND m.Desgn ="Manager" AND e.Salary = (select MIN(Salary) from Employee where DeptID=m.DeptId) ORDER BY e.FirstName DESC;
select d.deptId, empno, concat(FirstName, " ", LastName) "Employee Name", Salary from Employee d INNER JOIN Department e on d.deptId =e.deptId WHERE salary>(select AVG(salary) from Employee);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment