0
0
PostgreSQLquery~20 mins

UPPER, LOWER, INITCAP in PostgreSQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Master of Text Case Functions
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2: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;
Ahello world!
BHELLO WORLD!
CHello World!
DhELLO wORLD!
Attempts:
2 left
💡 Hint
UPPER converts all letters to uppercase.
query_result
intermediate
2:00remaining
What does LOWER do to mixed case text?
What is the output of this query?
PostgreSQL
SELECT LOWER('PostgreSQL Is Fun!') AS result;
Apostgresql is fun!
BpOSTGRESql iS fUN!
CPOSTGRESQL IS FUN!
DPostgreSQL Is Fun!
Attempts:
2 left
💡 Hint
LOWER converts all letters to lowercase.
query_result
advanced
2: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;
AWelcome To The World Of Sql
BWELCOME TO THE WORLD OF SQL
Cwelcome to the world of sql
DWelcome to the world of SQL
Attempts:
2 left
💡 Hint
INITCAP capitalizes the first letter of each word.
🧠 Conceptual
advanced
2: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?
AWHERE INITCAP(name) = 'Alice'
BWHERE LOWER(name) = 'ALICE'
CWHERE UPPER(name) = 'ALICE'
DWHERE name = 'alice'
Attempts:
2 left
💡 Hint
Think about converting both sides to the same case.
📝 Syntax
expert
2:00remaining
What error does this query raise?
Consider this query: SELECT INITCAP(12345) AS result; What error will PostgreSQL raise?
AERROR: syntax error at or near "12345"
BERROR: invalid input syntax for type integer
CNo error, returns '12345'
DERROR: function initcap(integer) does not exist
Attempts:
2 left
💡 Hint
INITCAP expects a string input, not a number.