The following SQL Server Not Exists query will find the Employees whose Occupation is neither Skilled Manual nor Clerical.

SELECT 
	E1.EmpID
       ,E1.Name
       ,E1.Occupation
FROM 
	Employee E1
WHERE NOT EXISTS
	( 
    		SELECT 
			* 
		FROM 
			Employee E2 
		WHERE 
			E1.EmpID = E2.EmpID 
			AND 
			Occupation IN ('Skilled Manual', 'Clerical')
	)

Sources:

https://www.tutorialgateway.org/sql-not-exists-operator/

Last modified: February 21, 2020

Author

Comments

Write a Reply or Comment