Skip to content
Course Notes: Introduction to Relational Databases in SQL
add text here
In the SQL cell below:
- Set the source to 'Course Databases' to query databases used in SQL courses.
- Set the source to 'DataFrames and CSVs' to query this course's CSV files (if any) with SQL
- Write SQL! Note that you cannot run queries that modify the database.
DataFrameas
df
variable
-- Select the names and most recent salaries of all current employees
-- Note that the query may take a long time to run if you remove the LIMIT statement
SELECT first_name,
last_name,
hire_date,
salary
FROM employees
INNER JOIN salaries USING(emp_no)
WHERE to_date = (SELECT MAX(to_date) FROM salaries)
ORDER BY emp_no
LIMIT 5