By admin | January 25, 2008

And & OR Operators in SQL

How to and where to use AND and OR Operators in Select Statement

We should remember a fundamental concept. AND restricts further and OR loosens the restrictions in the result set

SELECT ENAME, SAL FROM EMP WHERE DEPTNO=10 AND SAL>1500;

The above statement will display the restricted set of rows whose department no is 10 and SAL is greater than 1500.

If we use OR instead of AND

it will display the rows, where ever there is a department number 10 as well as SAL is greater than 1500

Digg Facebook Technorati Bloglines

Email This Post Email This Post
Topics: Database |



Leave a Comment

Name:

E-Mail :

Website :

Comments :

Ad

Calendar

November 2008
M T W T F S S
« Oct «-»  
 12
3456789
10111213141516
17181920212223
24252627282930

Search

Polls

  • Who will rule the world?

    View Results

    Loading ... Loading ...