Try a query

Sample queries

Start with a question about the data, then adapt the SQL for your own database engine.

Employees (browser edition)

Current department assignments

List the current department assignment for each employee with a current assignment, using the source view.

SELECT e.emp_no, e.first_name, e.last_name, d.dept_name, c.from_date FROM current_dept_emp AS c JOIN employees AS e USING (emp_no) JOIN departments AS d USING (dept_no) ORDER BY d.dept_name, e.last_name, e.first_name LIMIT 25;
Get the database →

Employees (browser edition)

Salary history for selected employees

Show retained salary history rows for the browser edition.

SELECT emp_no, salary, from_date, to_date FROM salaries ORDER BY emp_no, from_date LIMIT 25;
Get the database →