SQL [AND OR] Operator Tutorial

In this chapter you will learn:
AND|OR statement
Syntax of AND|OR statement
Example of this statement

About AND|OR statement

SQL AND|OR statement is the supporting statement of select statement which is used to retrieve data with a condition. If you use AND then it is must to true to condition but if you use OR statement then any one of the condition is true then it can retrieve data.

Syntax of and|or statement

1. Select * from table_name where condition1 AND condition2
2. Select * from table_name where condition1 OR condition2

Example of AND statement

select * from humanresources.employee where title='Sales Representative' and MaritalStatus='S'

example of and statemant

Example of OR statement

select * from humanresources.employee where title='Sales Representative' or MaritalStatus='S'

example of or statemant
SUMMARY

In this chapter, you have learned about AND|OR statement of SQL Server. In the next chapter you will learn about order by statement.

More Articles

 

Share your thought