SQL WHERE AND & OR multiple conditions
The SQL AND & OR operators are used to combine multiple conditions to narrow data in an SQL statement. These two operators are called as the conjunctive operators.
The SQL AND condition and OR condition can be combined to test for multiple conditions in a SELECT, INSERT, UPDATE, or DELETE statement.
The AND Operator - how to create - example
Syntax
The basic syntax of the AND operator with WHERE is as −
Example 1: Syntax of the AND operator with WHERE
SELECT column1, column2, columnN
FROM table_name
WHERE [condition1] AND [condition2]...AND [conditionN];
FROM table_name
WHERE [condition1] AND [condition2]...AND [conditionN];
Following is an example, which would fetch the ID, Surname and Fees fields from the USERS table, where the Fee is greater than 2525 AND the age is less than 30 years −
Example 2: the AND operator
SELECT ID, Surname, Fees
FROM USERS
WHERE Fee > 2525 AND age <30;
FROM USERS
WHERE Fee > 2525 AND age <30;
The OR Operator - Example - How to create
The OR operator is used to combine multiple conditions in an SQL statement's WHERE clause.
Example 3:The OR operator
SELECT column1, column2, columnN
FROM table_name
WHERE [condition1] OR [condition2]...OR [conditionN]
FROM table_name
WHERE [condition1] OR [condition2]...OR [conditionN]
Following is an example, which would fetch the ID, Surname and Fees fields from the USERS table, where the Fee is greater than 2525 OR the age is less than 30 years −
Example 4: the AND operator
SELECT ID, Surname, Fees
FROM USERS
WHERE Fee > 2525 OR age <30;
FROM USERS
WHERE Fee > 2525 OR age <30;
Syntax The syntax for the AND condition and OR condition together in SQL is:
Example 5: the AND condition and OR condition together in SQL is:
SELECT column1, column2, columnN
FROM table_name
WHERE condition1 AND condition2 ... OR condition_n;
FROM table_name
WHERE condition1 AND condition2 ... OR condition_n;
sql where and or
SQL WHERE AND & OR multiple conditions - sql tutorial
Online Editor
This tool makes it easy to create, adjust, and experiment with custom colors for the web.
HTML Templates

Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.
CSS HTML Layout

Find here examples of creative and unique website layouts.
Free CSS HTML Menu

Find here examples of creative and unique website CSS HTML menu.