EZ TuitionsAll tuitions

MySQL: IS NULL vs = NULL on a Supplied Table

To find missing Copies values, use Copies IS NULL, not Copies = NULL. On the supplied table below, the correct result is items 101 and 104. The equality version returns no rows, even though two values are missing.

Predict the selected item IDs before checking the answers. This is a read-only reasoning exercise with an invented four-row relation, not instructions to create, import or change a database.

Read the supplied relation before the query

The fictional relation is PracticeStock. ItemID is a unique integer identifier; Copies is a nullable integer; Note is nullable text. These types matter: compare the number zero in Copies and the empty text in Note separately, without mixed-type conversions.

PracticeStock: all four supplied rows
ItemIDCopiesNote
101NULL''
1020NULL
1033ready
104NULL''

Here NULL is a displayed marker for a missing value, not the text string 'NULL'. The two single quotes in '' denote an empty string, not a space. The number 0 is known zero. Do not infer NULL merely because a cell looks blank in another display.

Use a predicate that can be TRUE

IS NULL is TRUE for a NULL value and FALSE for a non-NULL value. IS NOT NULL reverses that test. They test whether a value is missing, not whether a number is positive or text looks filled.

In contrast, ordinary equality with NULL yields UNKNOWN, represented by NULL. That includes both 3 = NULL and NULL = NULL. UNKNOWN is not TRUE. A WHERE filter does not keep such a row. An empty result from the wrong equality query therefore does not prove that the table has no missing data.

Apply the condition independently to each row. Return its ItemID only if the condition is TRUE. The queries below include ORDER BY ItemID solely to make the displayed order explicit; without an ordering clause, do not assume a particular row order.

Predict, then check each SELECT result

Copies IS NULL

SELECT ItemID
FROM PracticeStock
WHERE Copies IS NULL
ORDER BY ItemID;

Expected ItemID rows: 101, 104.

Copies is missing for 101 and 104. Neither zero nor three is NULL.

Copies IS NOT NULL

SELECT ItemID
FROM PracticeStock
WHERE Copies IS NOT NULL
ORDER BY ItemID;

Expected ItemID rows: 102, 103.

Both zero and three are present numeric values. Zero is not a missing value.

Copies = NULL

SELECT ItemID
FROM PracticeStock
WHERE Copies = NULL
ORDER BY ItemID;

Expected ItemID rows: none (empty result).

This comparison is UNKNOWN, represented by NULL, for every row. WHERE keeps only TRUE, so it returns no rows.

Copies = 0

SELECT ItemID
FROM PracticeStock
WHERE Copies = 0
ORDER BY ItemID;

Expected ItemID rows: 102.

Only item 102 has the known numeric value zero.

Note IS NULL

SELECT ItemID
FROM PracticeStock
WHERE Note IS NULL
ORDER BY ItemID;

Expected ItemID rows: 102.

Only item 102 has a missing Note value. The empty strings in 101 and 104 are not NULL.

Note = ''

SELECT ItemID
FROM PracticeStock
WHERE Note = ''
ORDER BY ItemID;

Expected ItemID rows: 101, 104.

Items 101 and 104 have an empty string: a present text value of length zero.

Note IS NOT NULL

SELECT ItemID
FROM PracticeStock
WHERE Note IS NOT NULL
ORDER BY ItemID;

Expected ItemID rows: 101, 103, 104.

The empty strings and ready are all non-NULL text values.

These are documentation-derived expectations, not a transcript from a MySQL server. The table was invented for this contrast and is not a copy of NCERT Table 8.8 or its examples.

Catch the tempting wrong answer

A learner says: "IS NOT NULL means there is something useful, so remove zero and empty text." Check the predicate, not that informal description. Item 102 belongs in the Copies IS NOT NULL result because zero is a value. Items 101 and 104 belong in the Note IS NOT NULL result because empty strings are values too.

Now explain why item 102 is selected by Note IS NULL but not by Copies IS NULL. The predicates test different columns: its Note is missing, while its Copies value is known zero. Never treat NULL as a label for the entire row.

Where this fits in CBSE IP

The 2026-27 Informatics Practices 065 syllabus explicitly lists SELECT, WHERE, IS NULL and IS NOT NULL in Class XI Unit 3. Class XII Unit 2 revises the SQL commands studied in XI. The Class XII 2026-27 sample paper, question 17, asks for records whose Commission contains a value; its marking scheme chooses IS NOT NULL. That is evidence of the assessed distinction, not a prediction of a future question.

MySQL 8.4 is the documentation version used here, not a CBSE-mandated server version. This page covers only SELECT-result reasoning for the supplied values. It does not cover setup, data changes, imports, connectors, aggregates, or other language lessons.

Frequently asked questions

Why does Copies = NULL not find the missing values?

Ordinary equality with NULL gives UNKNOWN, represented by NULL, rather than TRUE. WHERE selects rows only when its condition is TRUE. Use Copies IS NULL to test for missing values in this table.

Does IS NOT NULL exclude zero?

No. Zero is a present numeric value. Item 102 has Copies equal to zero, so it passes Copies IS NOT NULL. Do not confuse a zero stored in the column with the truth value of the predicate used to select a row.

Is an empty string the same as NULL?

No. In this exercise, '' denotes a present text value containing no characters. NULL denotes a missing value. Note IS NULL selects 102, while Note = '' selects 101 and 104. A visually blank cell alone cannot tell you which was stored.

Can I use <> NULL instead of IS NOT NULL?

No. An ordinary comparison such as <> NULL also gives UNKNOWN rather than the required TRUE test. Use IS NOT NULL. Do not replace a NULL test with an ordinary equality or inequality comparison.

Is this an official CBSE table or a tested MySQL session?

Neither. EZ Tuitions invented this table and derived the expected rows from MySQL 8.4 documentation. It is not NCERT Table 8.8 or a reproduced examination dataset. No MySQL server session or application UI result was observed for this guide.

Sources and limits

Primary documents checked 26 November 2026. Curriculum and assessment sources establish school relevance; MySQL documentation establishes predicate behavior. The table, queries and explanations are original EZ Tuitions practice, with no CBSE or NCERT affiliation claimed.