Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the responsive-lightbox domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/wp-includes/functions.php on line 6114
Logical Operators - Testingpool

Logical Operators

In this post , we will discuss about Logical Operators.

AND Operator :

AND Operator is used to filter the records based on two or more than two conditions.

It is specified in the WHERE clause.

It filters the records only if all the specified conditions are true.

Syntax:

The record is selected if all the conditions specified in WHERE Clause are satisfied.

SELECT  <Col Name> FROM <Tablename>

WHERE <Condition 1> AND <Condition 2>…………AND <Condition N>;

OR Operator :

OR Operator is used to filter the records based on two or more than two conditions.

It is specified in the WHERE clause.

It filters the records only if either of the specified condition is true.

Syntax :

The record is selected if any of the condition specified in WHERE Clause is satisfied.

SELECT  <Col Name> FROM <Tablename>

WHERE <Condition 1> OR <Condition 2>…………OR <Condition N>;

Note : AND and OR operators can be used in combination as well.

SELECT  <Col Name> FROM <Tablename>

WHERE <Condition 1> AND <Condition 2> OR  <Condition 3>;

NOT Operator :

NOT Operator returns the record if the condition specified is not true.

It is specified in the WHERE clause.

It is a negate operator .

It can be used with other operators and just reverses the operator action like NOT IN , NOT BETWEEN, NOT EXISTS.

Syntax :

The record is selected if any of the condition specified in WHERE Clause is satisfied.

SELECT  <Col Name> FROM <Tablename>

WHERE  NOT( <Condition 1> );

Avatar photo

Shikha Katariya

Shikha

You may also like...