0
0
PostgreSQLquery~10 mins

Boolean column filtering patterns in PostgreSQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select rows where the boolean column is_active is true.

PostgreSQL
SELECT * FROM users WHERE is_active [1];
Drag options to blanks, or click blank then click option'
AIS NULL
B= TRUE
C= FALSE
DIS NOT TRUE
Attempts:
3 left
💡 Hint
Common Mistakes
Using = FALSE instead of = TRUE
Using IS NULL which checks for null values
Using IS NOT TRUE which excludes true values
2fill in blank
medium

Complete the code to select rows where the boolean column is_verified is false.

PostgreSQL
SELECT * FROM accounts WHERE is_verified [1];
Drag options to blanks, or click blank then click option'
A= FALSE
BIS TRUE
C= TRUE
DIS NULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using = TRUE instead of = FALSE
Using IS NULL which checks for null values
Using IS TRUE which checks for true values
3fill in blank
hard

Fix the error in the code to select rows where the boolean column is_deleted is not true.

PostgreSQL
SELECT * FROM records WHERE is_deleted [1];
Drag options to blanks, or click blank then click option'
A= FALSE
B= NULL
CIS NOT TRUE
DIS FALSE
Attempts:
3 left
💡 Hint
Common Mistakes
Using = FALSE excludes nulls
Using = NULL is invalid syntax
Using IS FALSE excludes nulls
4fill in blank
hard

Fill both blanks to select rows where is_published is true and is_archived is false.

PostgreSQL
SELECT * FROM articles WHERE is_published [1] AND is_archived [2];
Drag options to blanks, or click blank then click option'
A= TRUE
B= FALSE
CIS TRUE
DIS FALSE
Attempts:
3 left
💡 Hint
Common Mistakes
Using IS TRUE or IS FALSE inconsistently
Mixing up true and false checks
Using IS NULL instead of boolean checks
5fill in blank
hard

Fill all three blanks to select rows where is_active is true, is_verified is not true, and is_deleted is false.

PostgreSQL
SELECT * FROM users WHERE is_active [1] AND is_verified [2] AND is_deleted [3];
Drag options to blanks, or click blank then click option'
A= TRUE
BIS NOT TRUE
C= FALSE
DIS TRUE
Attempts:
3 left
💡 Hint
Common Mistakes
Using = FALSE for is_active
Using IS TRUE for is_verified instead of IS NOT TRUE
Using IS NOT TRUE for is_deleted