SQL Problems
SQL Problems
1. Download and Setup a local instance of MySQL on your computer / AWS machine
2. Create a new schema called salaries
3. In salaries scheme, Create employee and salary tables (use appropriate data structure for
each field)
4. Upload the data sets provided into the tables
5. Find the count of distinct departments.
6. Find the count of employees in each department.
7. Arrange all the employees in descending order by their names.
8. Find the department which have maximum number of employees.
9. Find the count of employees who have salary greater than 40000, greater than 60000 and
greater than 80000.
10. Find the count of employees in each department who have salary greater than 40000.
11. Find the average, min and max salary of tech departments (Engineering, IT & BI, Production)
and non-tech departments (Others)
12. Find the average salary of peers except the employee itself (that is, for each employee, its
peer would be everyone in the same department as the employee but excluding the
employee himself. Avg peer salary will be computed over these peers)
13. Find the number of employees, average salary and average tenure(date of joining to today)
in each bracket of age.
20-25
25-30
30-35
35-40
45-50
14. Find the salary of the youngest and eldest employee in each department.