Welcome Back

Google icon Sign in with Google
OR
I agree to abide by Pharmadaily Terms of Service and its Privacy Policy

Create Account

Google icon Sign up with Google
OR
By signing up, you agree to our Terms of Service and Privacy Policy
Instagram
youtube
Facebook

Find Employees Who Have Not Processed Any Orders in SQL

Find Employees Who Have Not Processed Any Orders in SQL


Employees Table:

 

 

orders Table:

Query Explanation:

● SELECT *
 Retrieves all columns from the Employees table.

● FROM Employees
 Specifies that data should be selected from the Employees table.

● WHERE EmployeeID NOT IN (...)
 Filters the employees by excluding those whose EmployeeID exists in the Orders table.

● SELECT DISTINCT EmployeeID FROM Orders
 Fetches all unique employee IDs who have processed at least one order.

This query helps identify employees who haven't processed any orders yet.

 

SQL Query:

USE SalesInventoryDB;
 
select * from Employees
where EmployeeID not in (select  orders.EmployeeID from orders);

 

Output: