This example illustrates how to use the boolean operator 'NOT' in the MySQL query.
This example illustrates how to use the boolean operator 'NOT' in the MySQL query.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 | +---------------------+
|