Home Tutorial Php Sql MySQL Boolean Operator

 
 

MySQL Boolean Operator
Posted on: December 9, 2010 at 12:00 AM
This example illustrates how to use the boolean operator 'NOT' in the MySQL query.

MySQL Boolean Operator

This example illustrates how to use the boolean operator 'NOT' in the MySQL query.

In this example we create a PROCEDURE 'boolproc' to find whether a=b or not. The procedure call by [call boolproc()], and it display the output 'a is not equal to b'.

 

Query

 

Output

 

delimiter $$
CREATE PROCEDURE boolproc()
     BEGIN
             DECLARE a INT DEFAULT 2;
             DECLARE b INT DEFAULT 3;
             DECLARE c FLOAT;
             IF NOT (a=b) THEN
                     SELECT 'a is not equal to b';
             END IF;
     END$$
delimiter ;
call boolproc();

 

+---------------------+
| a is not equal to b |
+---------------------+
| a is not equal to b |
+---------------------+

 

Related Tags for MySQL Boolean Operator:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.