How to Work with AND Logical Operator in SQL

In this article I am going to explain how to work with AND logical Operator in SQL.
  • 1720

Introduction

In this article I am going to explain how to work with logical operator in SQL. Logical operator in SQL create compound condition. This compound statement in SQL consist of two or more conditions. We use Logical operator with WHERE clause. We use it to find the specific record into result set from table stored in database. It is used to fetch specific row or specific record based on comparison.

There are three type of comparison operator in SQL server.

  • AND Logical Operator
  • OR Logical Operator
  • NOT Logical Operator

AND Logical Operator

AND logical operator return true when both condition are true otherwise it return false value. It means it works when both conditions are true.

Example

SELECT * FROM dbo.mcninvoices
WHERE invoicetotal>paymenttotal+creadittotal AND invoicetotal> 1000

Output

Clipboard06.jpg


© 2020 DotNetHeaven. All rights reserved.