0
0
SQLquery~10 mins

Three-valued logic (TRUE, FALSE, UNKNOWN) in SQL - 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 condition is TRUE in three-valued logic.

SQL
SELECT * FROM employees WHERE active IS [1];
Drag options to blanks, or click blank then click option'
ATRUE
BNULL
CUNKNOWN
DFALSE
Attempts:
3 left
💡 Hint
Common Mistakes
Using NULL instead of TRUE
Using = TRUE instead of IS TRUE
2fill in blank
medium

Complete the code to select rows where the condition is UNKNOWN in three-valued logic.

SQL
SELECT * FROM orders WHERE shipped_date IS [1];
Drag options to blanks, or click blank then click option'
AFALSE
BUNKNOWN
CTRUE
DNULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using IS NULL instead of IS UNKNOWN
Using IS FALSE instead of IS UNKNOWN
3fill in blank
hard

Fix the error in the WHERE clause to correctly filter rows where the condition is FALSE.

SQL
SELECT * FROM products WHERE discontinued IS [1];
Drag options to blanks, or click blank then click option'
ATRUE
BUNKNOWN
CFALSE
DNULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using = FALSE instead of IS FALSE
Using IS NULL instead of IS FALSE
4fill in blank
hard

Fill both blanks to complete the query that selects rows where the condition is either TRUE or UNKNOWN.

SQL
SELECT * FROM customers WHERE status IS [1] OR status IS [2];
Drag options to blanks, or click blank then click option'
ATRUE
BFALSE
CUNKNOWN
DNULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using IS NULL instead of IS UNKNOWN
Using IS FALSE instead of IS UNKNOWN
5fill in blank
hard

Fill all three blanks to create a CASE expression that returns 'Yes', 'No', or 'Unknown' based on a three-valued logic condition.

SQL
SELECT CASE WHEN approved IS [1] THEN 'Yes' WHEN approved IS [2] THEN 'No' ELSE [3] END AS approval_status FROM applications;
Drag options to blanks, or click blank then click option'
ATRUE
BFALSE
C'Unknown'
D'Pending'
Attempts:
3 left
💡 Hint
Common Mistakes
Using NULL instead of a string for ELSE
Mixing TRUE and FALSE in wrong order