Wednesday, 19 September 2007

Explain AND & OR conditions in SQL Server.

The AND & OR is used to join two or more conditions in a WHERE clause.

The AND operator displays a row if ALL the conditions listed are true.

Ex :
Select * from Employees
where EmployeeName = ‘Steve’
and City = ‘Bangalore

This Query will display the each person with EmployeeName equal to “Steve” and City equal to “Bangalore

The OR operator displays a row if ANY of the conditions listed are true

Ex :
Select * from Employees
where EmployeeName = ‘Steve’
or City = ‘Bangalore

This Query will display the each person with EmployeeName equal to “Steve” or City equal to “Bangalore”.

Labels: ,


Bookmark this Blog in your Favorites

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home