Challenge - 5 Problems
Master of Text Case Functions
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the output of this UPPER function?
Given the following SQL query, what will be the output?
PostgreSQL
SELECT UPPER('Hello World!') AS result;
Attempts:
2 left
💡 Hint
UPPER converts all letters to uppercase.
✗ Incorrect
The UPPER function converts all letters in the string to uppercase letters.
❓ query_result
intermediate2:00remaining
What does LOWER do to mixed case text?
What is the output of this query?
PostgreSQL
SELECT LOWER('PostgreSQL Is Fun!') AS result;
Attempts:
2 left
💡 Hint
LOWER converts all letters to lowercase.
✗ Incorrect
The LOWER function converts all letters in the string to lowercase letters.
❓ query_result
advanced2:00remaining
How does INITCAP format this sentence?
What will be the output of this query?
PostgreSQL
SELECT INITCAP('welcome to the world of SQL') AS result;
Attempts:
2 left
💡 Hint
INITCAP capitalizes the first letter of each word.
✗ Incorrect
The INITCAP function capitalizes the first letter of each word and makes the rest lowercase.
🧠 Conceptual
advanced2:00remaining
Which function would you use to make a case-insensitive search?
You want to find all rows where the column
name matches 'alice' regardless of case. Which function is best to use in the WHERE clause?Attempts:
2 left
💡 Hint
Think about converting both sides to the same case.
✗ Incorrect
Using UPPER(name) = 'ALICE' converts the column to uppercase and compares it to uppercase 'ALICE', making the search case-insensitive.
📝 Syntax
expert2:00remaining
What error does this query raise?
Consider this query:
SELECT INITCAP(12345) AS result; What error will PostgreSQL raise?Attempts:
2 left
💡 Hint
INITCAP expects a string input, not a number.
✗ Incorrect
The INITCAP function requires a string argument. Passing an integer causes PostgreSQL to report that the function with integer argument does not exist.