Skip to content
Astera Technology

Why does a yes flag fail while the text 1 passes?

Compare the declared textual truth code explicitly.

Download complete case notes and answer keys ↓

Prepare the report input

The fictional source uses exact text yes for confirmed selection. no is unselected; 1 is an unexpected raw code. WHERE flag_text invokes SQLite numeric truth conversion rather than the source’s text meaning.

Every record and report rule below is original and fictional. Reproduce the setup in a fresh SQLite test database; input previews include every table in this small fixture.

Synthetic input: flags
idflag_text
Ayes
Bno
C1
Download editable CSV ↓
Complete CREATE and INSERT fixture
CREATE TABLE flags(id TEXT PRIMARY KEY,flag_text TEXT); INSERT INTO flags VALUES('A','yes'),('B','no'),('C','1');

Compare misleading and corrected results

Misleading SELECT: reproduce the defect
SELECT id,flag_text FROM flags WHERE flag_text ORDER BY id;
Literal misleading result
idflag_text
C1
Download editable CSV ↓
Corrected SELECT
SELECT id,flag_text FROM flags WHERE flag_text='yes' ORDER BY id;
Literal corrected result
idflag_text
Ayes
Download editable CSV ↓

The misleading query returns only C=1, while the correct confirmed-selection list is A=yes. Unexpected values remain in the input for separate review.

Check a fresh boundary case

Add NULL flag D. It is not a confirmed yes and does not join the corrected list.

Recreate the original setup in another fresh database, then apply the change and corrected query below. For an empty result, the table displays a labelled empty-result marker rather than a data record.

Boundary change and corrected query
INSERT INTO flags VALUES('D',NULL);
SELECT id,flag_text FROM flags WHERE flag_text='yes' ORDER BY id;
Literal boundary result
idflag_text
Ayes
Download editable CSV ↓

Which record is confirmed selected under the supplied text code?

Show the worked answer

A only. C’s numerically truthy text 1 does not satisfy the declared yes code.

Related resources