AND & OR Operators in SQL
AND & OR Operators in SQL :-The both operators are used to filter records based on more than one condition
AND operator :- This operator displays a record if both the first condition AND the second condition are true.
OR operator :- This operator displays a record if either the first condition OR the second condition is true.
Example :- We have a table named is tblStudentRecord
Now, we use the AND operator and get following output.
Now, we use the OR operator and get following output.
AND operator :- This operator displays a record if both the first condition AND the second condition are true.
OR operator :- This operator displays a record if either the first condition OR the second condition is true.
Example :- We have a table named is tblStudentRecord
Now, we use the AND operator and get following output.
SELECT * FROM tblStudentRecord WHERE Name='Santosh kumar singh' AND Address='A-3033'
Now, we use the OR operator and get following output.
SELECT * FROM tblStudentRecord WHERE Name='Santosh kumar singh' OR Address='A-3033'