
AND Operator In SQL
In SQL AND operator is used to display only those records where both the conditions, condition-1 and condition-2 evaluate to True.
In other words, we say that " SQL AND operator is a conditional Operator is used to display a record if all the conditions separated by AND are TRUE.
Syntax of AND Operator
The basic syntax of AND operator is given below
SELECT column1, column2, ... FROM table_name WHERE condition1 AND condition2 AND condition3 ...;
SELECT * FROM Employee WHERE Country='India' AND City='Uttar Pradesh';
OR Operator In SQL
In SQL OR operator is used to display the records where either one of the conditions condition1 or condition2 evaluates to True. That is, either condition1 is True or condition2 is True.
In other words, we say that " SQL OR operator is a conditional Operator is used to display a record if any of the conditions separated by OR is TRUE.
Syntax of OR Operator
The basic syntax of the OR operator is given below
SELECT column1, column2, ... FROM table_name WHERE condition1 OR condition2 OR condition3 ...;
SELECT * FROM Employee WHERE Country='India' OR City='Uttar Pradesh';
The basic syntax of the NOT operator is given below.
SELECT column1, column2, ... FROM table_name WHERE NOT condition;
SELECT * FROM Employee WHERE NOT Country='India';
0 Comments