- SQL Basics
- SQL Home
- SQL Syntax
- SQL RDBMS
- SQL Databases
- SQL Data Types
- SQL Operators
- SQL Expressions
- SQL Database
- SQL Create Database
- SQL Select Database
- SQL Drop Database
- SQL Table
- SQL Create Table
- SQL Drop Table
- SQL Keywords
- SQL Insert Into
- SQL Select
- SQL Where
- SQL And & Or
- SQL Update
- SQL Delete
- SQL Like
- SQL Select Top
- SQL Group By
- SQL Order By
- SQL Distinct
- SQL In
- SQL Between
- SQL Joins
- SQL Joins
- SQL Inner Join
- SQL Left Join
- SQL Right Join
- SQL Full Join
- SQL Constraints
- SQL Constraints
- SQL Unique
- SQL Not Null
- SQL Primary Key
- SQL Foreign Key
- SQL Check
- SQL Default
- SQL Create Index
- SQL Advance
- SQL Aliases
- SQL Union
- SQL Auto Increment
- SQL Views
- SQL Dates
- SQL Transactions
- SQL Injection
- SQL Test
- SQL Online Test
- Give Online Test
- All Test List
SQL And & Or Operator
SQL AND & OR operators are basically used to filter the records based on multiple conditions.
SQL AND Operator
The SQL AND operator is used to display a record only if both the first condition AND the second condition becomes true. Here is the general form of the AND operator with SQL WHERE Clause:
SELECT col1, col2, colN FROM table_name WHERE [condition1] AND [condition2]...AND [conditionN];
SQL AND Operator Example
Here is an example of SQL AND operator. Let's consider the following table CUSTOMERS having the records:

Following is an example, which will fetch the following columns:
- ID
- Name
- Salary
from the table CUSTOMERS where salary is greater than 78000.00 AND age is less than 32 years
SELECT ID, NAME, SALARY FROM CUSTOMERS WHERE SALARY > 78000.00 AND age < 32;
After querying the above SQL statements, you will get the following output:

SQL OR Operator
The SQL OR operator is used to display a record only if either the first condition OR the second condition becomes true. Here is the general form of the OR operator with the WHERE clause in SQL:
SELECT col1, col2, colN FROM table_name WHERE [condition1] OR [condition2]...OR [conditionN]
SQL OR Operator Example
Here is an example of SQL OR operator. Let's consider the table named CUSTOMERS having the following records:

Following is an example, which will fetch the following columns:
- ID
- Name
- Salary
from the table CUSTOMERS where salary is greater than 86000.00 OR age is less than 30 years
SELECT ID, NAME, SALARY FROM CUSTOMERS WHERE SALARY > 86000.00 OR age < 30;
After querying the above SQL statements, you will get the following output:

« Previous Tutorial Next Tutorial »
Like/Share Us on Facebook 😋