SQL - Structured Query Language

Query with Operator



By default, logical operators are used to test for the truth of some condition that returns a Boolean data type with a value of TRUE, FALSE or UNKNOWN. Subquery can declare with logical operator that returns one or many record(s). The following subqueries are used to find out list of employees who have (not) working in the System Department.

-- Example 52 --

 

USE EBusiness

GO

 

SELECT Emp_Name FROM EMP

WHERE Dept_Code IN

(SELECT Dept_Code FROM DEPT

WHERE Dept_Name = 'System')

 

SELECT Emp_Name FROM EMP

WHERE Dept_Code NOT IN

(SELECT Dept_Code FROM DEPT

WHERE Dept_Name = 'System')


Query Output Screen

* * * * *


Email Your Comment To AUTHOR