I'm trying to answer these questions but I'm not understanding the whole joining and functions part of MySQL. Can someone show me or explain these to me?
this is the link to the employee database we are using - https://github.com/datacharmer/test_db
- I want to know how many employees with each title were born after 1965-01-01.
- I want to know the average salary per title.
- How much money was spent on salary for the marketing department between the years 1990 and 1992?
This is what I have so far for each one.
1.
select count(title) as "Number Of Employees", title from titles GROUP BY title LIMIT 20;
SELECT d.dept_name as "Department", avg(s.salary) as "Average Salary" from departments d
INNER JOIN dept_emp de on de.dept_no = d.dept_no
INNER JOIN salaries s on s.emp_no = de.emp_no
GROUP BY d.dept_name;
- and this one seems like it's just those two put together so I completely don't understand it.