SQL AND & OR Operators

0
185

sqltuts

We can link multiple WHERE statements by AND/OR statements.

AND means that all the conditions are TRUE.

OR means, at least, one condition is TRUE.

 

For example, consider the following table Employee:

Employee_id First_name Last_name sex
123 Mack Johnson male
124 Jack Obama male
125 Queen Khan female

 

Example of using AND:

 

This will give the following result:

First_name
Mack

Example of using OR

First_name
Mack
Jack

 

In this case, we see two names as one condition (sex=’male’) for them is true.

Example of using AND & OR

This will give the following output:

First_name
Mack
Jack

 

Uses of AND OR in different aspects

 

 

 

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.