• 20 hours
  • Medium

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 4/19/21

Get Some Practice Executing Advanced SQL Queries

Log in or subscribe for free to enjoy all this course has to offer!

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:

Employees database scheme
Employees database scheme

Further Instructions

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.

  1. 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).

  2. Using the IN keyword and a nested query, provide the different salaries of employees hired (strictly) after the '1999-08-20'.

  3. Display only the five oldest employees, displaying all the columns of the employees table just as they are.

  4. 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.

Deliverables

  • The SQL query

  • A screen capture of the table

Check Your Work

Example of certificate of achievement
Example of certificate of achievement