SQL Logical operators

What is Logical operators?

Types of Logical operators

Example of Logical operators

What is Logical operators?

There are so many logical operators in which every operator has different types of work. Here all logical operators described with some examples.

Types of Logical operators

Logical Operator

ALL

AND

ANY

BETWEEN

EXISTS

IN

LIKE

NOT

OR

SOME

ISNULL

UNIQUE

Example

select * from Sales.Customer
where CustomerType='s'
and (TerritoryId='4' or TerritoryId='5');

Output

Example Description

In the above example only those data retrieve from database which customer type is s and TerritoryId is 4 or 5. You can see the output in the figure.

SUMMARY

Here you have learned the logical operators and its type. An example of and, or logical operator is also given herewith output. In the next chapter you will learn about String concatenation operator and its type.