The query filters rows by checking the Boolean column in the WHERE clause, including only rows where the condition is TRUE.
Execution Sample
PostgreSQL
SELECT * FROM tasks WHERE completed = TRUE;
This query returns all rows from the tasks table where the completed column is TRUE.
Execution Table
Step
Row ID
completed value
Condition (completed = TRUE)
Include in Result
1
1
TRUE
TRUE = TRUE
Yes
2
2
FALSE
FALSE = TRUE
No
3
3
TRUE
TRUE = TRUE
Yes
4
4
NULL
NULL = TRUE (unknown)
No
5
5
FALSE
FALSE = TRUE
No
6
6
TRUE
TRUE = TRUE
Yes
Exit
-
-
No more rows
Filtering complete
💡 All rows checked; only rows with completed = TRUE included.
Variable Tracker
Variable
Start
After Row 1
After Row 2
After Row 3
After Row 4
After Row 5
After Row 6
Final
completed
N/A
TRUE
FALSE
TRUE
NULL
FALSE
TRUE
N/A
Condition Result
N/A
TRUE
FALSE
TRUE
UNKNOWN
FALSE
TRUE
N/A
Included in Result
N/A
Yes
No
Yes
No
No
Yes
N/A
Key Moments - 2 Insights
Why are rows with NULL in the Boolean column not included?
Because in SQL, NULL means unknown, and the condition 'completed = TRUE' evaluates to unknown, which is treated as false in WHERE filtering (see execution_table row 4).
What happens if we write 'WHERE completed' instead of 'WHERE completed = TRUE'?
Both are equivalent in PostgreSQL; the condition checks if completed is true. The execution flow and results remain the same.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at step 2, what is the condition result for completed = TRUE?
ATRUE
BFALSE
CUNKNOWN
DNULL
💡 Hint
Check the 'Condition (completed = TRUE)' column at step 2 in the execution_table.
At which step does the condition evaluate to UNKNOWN?
AStep 4
BStep 3
CStep 5
DStep 6
💡 Hint
Look for 'NULL = TRUE (unknown)' in the Condition column in the execution_table.
If we change the query to 'WHERE completed = FALSE', which row(s) would be included?
ARows 4 and 5
BRows 1, 3, and 6
CRows 2 and 5
DRows 1 and 6
💡 Hint
Refer to the 'completed value' column and think which rows have FALSE.
Concept Snapshot
Boolean column filtering in SQL:
Use WHERE column = TRUE to select rows where the Boolean column is true.
Rows with FALSE or NULL are excluded.
NULL means unknown and does not pass the filter.
'WHERE column' is shorthand for 'WHERE column = TRUE'.
Full Transcript
This visual execution trace shows how a SQL query filters rows based on a Boolean column named 'completed'. The query selects rows where completed is TRUE. Each row's completed value is checked against TRUE. Rows with TRUE pass the condition and are included in the result. Rows with FALSE or NULL do not pass and are excluded. NULL is treated as unknown and fails the filter. The trace highlights that 'WHERE completed' is equivalent to 'WHERE completed = TRUE' in PostgreSQL. This helps beginners understand how Boolean filtering works in SQL and why NULL values behave differently.