Home Tutorial Php Sql MySQL Boolean Operator

 
 

Share on Google+Share on Google+
MySQL Boolean Operator
Posted on: December 9, 2010 at 12:00 AM
Advertisement
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 |
+---------------------+

 

Advertisement

Related Tags for MySQL Boolean Operator:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 9, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com