MySQL IS Operator

The MySQL IS operator tests an expression against TRUE, FALSE, or UNKNOWN. In MySQL, zero is false, any nonzero non-NULL numeric value is true, and NULL represents unknown.

SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;
1 IS TRUE0 IS FALSENULL IS UNKNOWN
111

Reading Boolean-style TINYINT data

The sample plus2_boolean table stores integer values. IS TRUE matches nonzero, non-NULL values.

SELECT * FROM `plus2_boolean` WHERE mar IS TRUE;
namejanfebmar
Alex101
John102
Lone114
KingNULLNULL1

IS NOT TRUE

SELECT * FROM `plus2_boolean` WHERE jan IS NOT TRUE;

Output:

namejanfebmar
Ronn010
RajuNULL10
KingNULLNULL1

IS NOT TRUE includes both false values and NULL values.

IS UNKNOWN

SELECT * FROM `plus2_boolean` WHERE jan IS UNKNOWN;

Output:

namejanfebmar
RajuNULL10
KingNULLNULL1

IS UNKNOWN is true only when the expression is NULL. See also NULL handling and the comparison operators.

Using IS with character columns

MySQL can coerce strings to numbers in Boolean contexts. That behavior is demonstrated below, but application queries should normally compare character data explicitly instead of depending on numeric coercion.

SELECT * FROM student3 WHERE class IS TRUE;

Output:

idnameclassmark
7My John Rob55

A numeric-looking value such as '5' can evaluate as true after conversion.

SELECT * FROM student3 WHERE class IS FALSE;

Non-numeric text converts differently from meaningful Boolean data, which is why explicit comparisons are clearer.

SELECT * FROM student3 WHERE class IS UNKNOWN;

Output:

idnameclassmark
2Max RuinNULL85
4Krish StarNULLNULL
6Alex JohnNULL55

This returns rows where class is NULL.

Checkbox matrix example using Boolean data

Sample table

The original student3 SQL dump is retained below for testing.

For conditional output and NULL fallback, see IF(), COALESCE(), and CASE and summing multiple columns.




Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer