Use this space to put some text. Update this text in HTML

468x60 banner ad

Advertise with Us

Powered by Blogger.

Friday 15 April 2016

SQL AND Operator

The AND Operator is used to display result on the basis of both condition are TRUE (means first and second condition are true). 

The AND Operator return the Boolean expressions that is TRUE or FALSE.

When more than one logical operator is used in a statement, the AND operators are evaluated first. 

Syntax:


The basic syntax of AND operator with WHERE clause is as follows:
 

SELECT column1, column2, columnN

FROM table_name

WHERE [condition1] AND [condition2]...AND [conditionN];

Examples:

Please Read the Previous Article for SQL-Table Structure  


Example1

Fetch First_name, Last_name, Salary, Department and City fields from the Employee table where First_name is Philip AND salary is 750000.

SELECT First_name,Last_name, Salary, Department, City
FROM Employee
WHERE First_name='Philip' AND Salary=750000

Example2

Fetch First_name,Last_name, Salary, Department and City fields from the Employee table where City is Delhi AND salary greater than 650000.

SELECT First_name,Last_name, Salary, Department, City
FROM Employee
WHERE City='Delhi' AND Salary > 650000.00

Example3

Fetch First_name,Last_name, Salary, Department and City fields from the Employee table where City not in Delhi AND salary less than 1000000.

SELECT First_name,Last_name, Salary, Department,City
FROM Employee
WHERE City !='Delhi' AND Salary < 1000000.00


 




 

No comments :

Post a Comment

Ask a Question?