Practice Logical Operator with Employees
Practice Logical Operator with Employees  Data Science Project
Advanced SQL

Practice Logical Operator with Employees

In this project you will work with the employees database to explore and analyze key employee attributes and trends using logical operators in SQL.The project is designed to improve your ability to write precise queries, extract meaningful insights, and handle different types of constraints commonly encountered in database management systems.
Start this project
Practice Logical Operator with Employees Practice Logical Operator with Employees
Project Created by

Vidhi Shah

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.

codevalidated

Identify Long-Serving Senior Engineers

Write a query to retrieve:

  • All the information for employees from the titles table and apply the following filtering criteria :

    • Include employees who hold the title Senior Engineer
    • AND were hired before January 1, 1990
    • AND are still currently employed (indicated by to_date of '9999-01-01')
  • Order the results by from_date in ascending order.

codevalidated

Find Long-term Staff Members with Specific Hire Dates

Write a query to retrieve:

  • All the information for employees from the titles table who :

    • Currently hold the title Staff or Senior Staff (indicated by to_date '9999-01-01')
    • AND were hired in the 1980s or 1990s
    • AND have been in their current position for more than 15 years (indicated by from_date '2009-01-01')
  • Order the results by emp_no

codevalidated

Retrieve Senior Employees Active in the Company

Write a query to retrieve the emp_no, title, and from_date of employees from the titles table who are currently employed as Senior Engineer or Senior Staff and have been with the company since before January 1, 1996.

codevalidated

Filter Employees Based on Work Duration

Write a query to retrieve all the information of employees from the titles table who worked as Assistant Engineer or Engineer for at least 5 years but are not currently employed.

codevalidated

Identify High-Earning Employees with Long Tenure

Write a query to retrieve all the information of employees from the salaries table who have a salary greater than 80000, are still currently employed (indicated by to_date of '9999-01-01') and were hired before 2005-01-01. Order the result by salary in descending order.

codevalidated

Find Employees with Specific Salary Changes

Write a query to retrieve all the information of employees from the salaries table who meet the following criteria:

  • Their current salary (indicated by to_date of '9999-01-01') is between 70000 and 80000
  • OR they had a salary change after January 1, 2000 ( indicated by to_date )
  • AND their employment period (from_date) started after January 1, 1995
  • Order the results by emp_no, then by from_date.
codevalidated

Find Male Employees Hired in the 1980s

Write a query to retrieve the emp_no, first_name, last_name, gender, and hire_date of male employees from the employees table (gender = 'M') who were hired between January 1, 1980 (inclusive), and January 1, 1990 (exclusive). Order the results by hire_date.

codevalidated

Identify Female Employees Born After 1960 and Hired Before 1990

Write a query to retrieve the emp_no, first_name, last_name, birth_date, and hire_date of female employees from the employees table (gender = 'F') who were born after January 1, 1960, and hired before January 1, 1990. Order the results by birth_date.

codevalidated

List Employees with First Names Starting with 'A' to 'M' and Hired in the 1990s

Write a query to retrieve the emp_no, first_name, last_name, and hire_date of employees from the employees table whose first names alphabetically come before N, and who were hired between January 1, 1990 (inclusive), and January 1, 2000 (exclusive). Order the results by first_name and hire_date.

codevalidated

Find Employees Born in the 1950s with Last Names starting in 'a' to 'm'

Write a query to retrieve the emp_no, first_name, last_name, and birth_date of employees from the employees table who were born between January 1, 1950 (inclusive), and January 1, 1960 (exclusive), and whose last names alphabetically fall between a and m ( both inclusive ). Order the results by last_name and birth_date.

codevalidated

Find Current Employees in Departments

Write a query to retrieve the emp_no, dept_no, from_date, and to_date of employees from the dept_emp table who are currently working (indicated by to_date = '9999-01-01') in departments numbered between d001 and d005. Order the results by dept_no and from_date.

codevalidated

Identify Employees with Department Changes in the 1990s

Write a query to retrieve the emp_no, dept_no, from_date, and to_date of employees from the dept_emp table who either started working in the 1990s (between January 1, 1990 (inclusive), and January 1, 2000 (exclusive)), or whose employment ended within this time frame but are no longer working (indicated by to_date not being '9999-01-01'). Order the results by from_date.

Practice Logical Operator with Employees Practice Logical Operator with Employees
Project Created by

Vidhi Shah

As a Project Author at DataWars, I dive into the world of data science and AI/ML with a millennial flair, constantly intrigued by the inner workings of technology. While I'm not crunching numbers, you'll find me cheering for my favorite cricket team.

As a Project Author at DataWars, I dive into the world of data science and AI/ML with a millennial flair, constantly intrigued by the inner workings of technology. While I'm not crunching numbers, you'll find me cheering for my favorite cricket team.

This project is part of

Advanced SQL

Explore other projects