• 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 Simple 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. Display all of the rows of the employees table, showing only the employees’ first and last names.

  2. Display all employees who were hired after August 1, 1999 (non-inclusive).

  3. In this database, two tables are of the same schema. Combine them using a Union operator.

  4. Display the identifier and different salaries of the employee who was born on this date:  '1964-01-31', using a join.

  5. Using the join operator, produce a table specifying the name(s) of the department(s) in which the employee associated with identifier 499902 has worked (the table must also contain the start and end dates of employment in each department, as well as the employee’s last name and first name).

  6. Using aggregation, find out how many people have the last name "Gewali" (the last name is provided in the last_name column of the "employees" table).

Deliverables

  • The SQL queries

  • A screen capture of the table

Check Your Work!

Example of certificate of achievement
Example of certificate of achievement