Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
Or and and condition in sql server in Queries of SQL Queries
3106 Views
Hints 
"and" used to compare two column values in where condition.If both condition statisfies select command select the column which is related to that conditions.

"or" used to compare two column values in where condition.If any one condition statisfies select command select the column which is related to that conditions.

In following example and & or are used together.
Syntax
select columnName from tableName where (condition1 or condition2)and condition3;

//select the column where the condition1,condition2 any one of that statisfying and condition3
must be statisfying.
Example
Get the employee numbers for all employees who have a
leading job( i.e., Analyst or Manager) in project p1..

select emp_no from Works_on where (job='Analyst' or job='Manager')and project_no='p1';
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details