It's Your Turn!
The goal of this exercise is to write queries in a database to find the answers to specific questions. This database models a company in which people are employed in different departments.
The database you'll use contains the following six tables:
employees: company employees
titles: the job title under which the employee was hired
salaries: the salaries of the employees
departments: the company’s departments
dept_manager: the managers (heads) of the departments
dept_emp: the employees associated with a given department
These tables are summarized in this diagram:
For each question, provide the SQL query you used to obtain the result, along with a screen capture of the table that was returned by your query. If the result of a query contains many rows, a screen capture of only the first few rows is sufficient.
Without using nested queries, produce a table that displays the last names of over 200 employees (the last name is provided by the last_name column of the employees table).
Using the IN keyword and a nested query, provide the different salaries of employees hired (strictly) after the '1999-08-20'.
Display only the five oldest employees, displaying all the columns of the employees table just as they are.
Display employees whose last names contain “s” as the second letter, displaying all the columns of the employees table just as they are. Use the LIKE keyword.
The SQL query
A screen capture of the table