SQL Logical Operators (And, Or, Like, In, Between, Exists, Not, ALL, Any)

Here we will learn what are the logical operators in sql server and how to use logical operators in sql select statements or queryies with examples

SQL Logical Operators

In sql, logical operators are used to perform some conditional and comparison checks in SQL statements. In logical operators we have a different type of operators available, those are 

 

For more information related to logical operators in sql server check following information

 

OperatorDescription
AND The AND operator in SQL is used to compare data with more than one condition. If all the conditions returns TRUE then only it will display records.
OR The OR operator in SQL is used to compare data with more than one condition. If either of condition is TRUE it will return data.
ALL The ALL operator in SQL returns true when value matches with all values in single column set of values. It’s like AND operator it will compare value against with all values in column.
ANY The Any operator in SQL returns true when value matches with any value in single column set of values. It’s like OR operator it will compare value against with any value in column.
LIKE The LIKE operator in SQL is used to search for character string with specified pattern using wildcards in column.
IN The IN operator in SQL is used to search for specified value matches any value in set of multiple values.
BETWEEN The BETWEEN operator in SQL is used to get values within range.
EXISTS The EXISTS operator in SQL is used to show result if subquery returns data.
NOT The NOT operator in SQL is a negate operator that means it will show data for opposite of conditions what we mentioned in SQL statement.
SOME The SOME operator in SQL is used to compare value with a single column set of values returned by subquery. SOME must match at least one value in subquery and that value must be preceded by comparison operators.

Topics Covered