SQL Logical Operators

Logical Operators in SQL are used to combine or manipulate conditions in SQL queries to retrieve or manipulate data based on specified criteria..

Operator Description
AND

Logical AND compares two Booleans as expressions and returns true when both expressions are true.

OR

Logical OR compares two Booleans as expressions and returns true when one of the expressions is true.

NOT

Not takes a single Boolean as an argument and change its value from false to true or from true to false.

SQL Logical Operators Example

In this example, retrieve all records from the “employee” table where the “emp_city” column is equal to ‘Allahabad’ and the “emp_country” column is equal to ‘India’.

SELECT * FROM employee WHERE emp_city = 
'Allahabad' AND emp_country = 'India';

Output:

 

SQL Operators

SQL Operators perform arithmetic, comparison, and logical operations to manipulate and retrieve data from databases.

In this article, we will discuss Operators in SQL with examples, and understand how they work in SQL.

Similar Reads

Operators in SQL

Operators in SQL are symbols that help us to perform specific mathematical and logical computations on operands. An operator can either be unary or binary....

Types of Operators in SQL

Different types of operators in SQL are:...

SQL Arithmetic Operators

Arithmetic operators in SQL are used to perform mathematical operations on numeric values in queries. Some common arithmetic operators are:...

SQL Comparison Operators

Comparison Operators in SQL are used to compare one expression’s value to other expressions. SQL supports different types of comparison operator, which are described below:...

SQL Logical Operators

Logical Operators in SQL are used to combine or manipulate conditions in SQL queries to retrieve or manipulate data based on specified criteria.....

SQL Bitwise Operators

Bitwise operators in SQL are used to perform bitwise operations on binary values in SQL queries, manipulating individual bits to perform logical operations at the bit level. Some SQL Bitwise Operators are:...

SQL Compound Operators

Compound operator in SQL are used to perform an operation and assign the result to the original value in a single line. Some Compound operators are:...

SQL Special Operators

Special operators are used in SQL queries to perform specific operations like comparing values, checking for existence, and filtering data based on certain conditions....

Conclusion

SQL Operators are used to perform various operations on the data using SQL queries. These operators simplify arithmetic, comparison , logical, and bitwise operations on the data....