HOME | PHP Tutorial | CSS
facebook icon
AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP
PHP Tutorial

PHP forms
HTML Tutorial

CSS Tutorial

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];

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;


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]



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;


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;


sql where and or SQL WHERE AND & OR multiple conditions - sql tutorial

2560. Disclaimer - SQL Tutorial

http://www.sql-tutorial.net/disclaimer.asp

2570. SQL DELETE - SQL Tutorial

http://www.sql-tutorial.net/SQL-DELETE.asp

2581. SQL ORDER BY - SQL Tutorial

http://www.sql-tutorial.net/SQL-ORDER-BY.asp

3295. SQL mysql order by columns, by date, by asc, by desc, random with PHP, sql tutorial
SQL mysql order by columns, by date, by asc, by desc, random with PHP sql tutorial
https://www.agernic.com/sql-tutorial/sqlL-mysql-order-by-columns-asc--desc--random-with-php.html

2564. SQL AND & OR - SQL Tutorial

http://www.sql-tutorial.net/SQL-AND-OR.asp

3291. SQL IN Operator - example, sql tutorial
SQL IN Operator - example sql tutorial
https://www.agernic.com/sql-tutorial/sql-in-operator-with-example.html

Your add here
PHP strcmp() function

PHP rtrim() function

PHP printf() function

PHP str_split() function

PHP trim() function

PHP str_replace() function

PHP html_entity_decode() function

PHP htmlspecialchars() function

PHP print() function

PHP ucwords() function

PHP htmlentities() function

PHP lcfirst() function

PHP count() Function

PHP md5() function

PHP implode() function

PHP similar_text() function

SQL - Syntax
HTML - Elements: body, head, title
PHP if, else and elseif Statements
CSS Margin, top, bottom, left, righ, auto
HTML Font Face
CSS Text Wrap