Recall & Review
beginner
What does the UPPER() function do in MySQL?
The UPPER() function converts all letters in a string to uppercase letters.
Click to reveal answer
beginner
What is the purpose of the LOWER() function in MySQL?
The LOWER() function converts all letters in a string to lowercase letters.
Click to reveal answer
beginner
How would you convert the string 'Hello World' to all uppercase using MySQL?
Use the query: SELECT UPPER('Hello World'); which returns 'HELLO WORLD'.
Click to reveal answer
beginner
How can you convert a column named 'name' to lowercase in a SELECT query?
Use: SELECT LOWER(name) FROM table_name; This returns the 'name' values all in lowercase.
Click to reveal answer
intermediate
Why might you use UPPER() or LOWER() functions when comparing strings in SQL?
To make string comparisons case-insensitive by converting both strings to the same case before comparing.
Click to reveal answer
What will SELECT UPPER('mysql') return?
✗ Incorrect
UPPER() converts all letters to uppercase, so 'mysql' becomes 'MYSQL'.
Which function converts all letters in a string to lowercase in MySQL?
✗ Incorrect
LOWER() is the correct function to convert strings to lowercase.
How would you write a query to select all names in uppercase from a table called users?
✗ Incorrect
SELECT UPPER(name) FROM users; converts the 'name' column values to uppercase.
If you want to compare two strings ignoring case, what should you do?
✗ Incorrect
Converting both strings to the same case with UPPER() or LOWER() makes comparison case-insensitive.
What does SELECT LOWER('HELLO WORLD'); return?
✗ Incorrect
LOWER() converts all letters to lowercase, so 'HELLO WORLD' becomes 'hello world'.
Explain how UPPER() and LOWER() functions work in MySQL and give an example of each.
Think about changing letter cases in words.
You got /4 concepts.
Why is it useful to use UPPER() or LOWER() when comparing text data in SQL?
Consider comparing 'Apple' and 'apple'.
You got /3 concepts.