0
0
SQLquery~10 mins

UPPER and LOWER functions in SQL - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - UPPER and LOWER functions
Input String
Apply UPPER or LOWER
Return Modified String
Use in Query Result
The input string is taken, converted to all uppercase or lowercase letters, then returned for use in query results.
Execution Sample
SQL
SELECT UPPER('Hello World') AS upper_text,
       LOWER('Hello World') AS lower_text;
This query converts the string 'Hello World' to uppercase and lowercase.
Execution Table
StepFunctionInputOutput
1UPPER'Hello World''HELLO WORLD'
2LOWER'Hello World''hello world'
3Query ResultN/Aupper_text = 'HELLO WORLD', lower_text = 'hello world'
💡 Both functions processed the input string and returned the converted strings.
Variable Tracker
VariableStartAfter UPPERAfter LOWERFinal
input_string'Hello World''Hello World''Hello World''Hello World'
upper_textNULL'HELLO WORLD''HELLO WORLD''HELLO WORLD'
lower_textNULLNULL'hello world''hello world'
Key Moments - 2 Insights
Why does UPPER('Hello World') return 'HELLO WORLD' and not change numbers or symbols?
UPPER only changes alphabetic letters to uppercase. Numbers and symbols stay the same, as shown in execution_table step 1.
Does LOWER('Hello World') affect spaces or punctuation?
No, LOWER only changes letters to lowercase. Spaces and punctuation remain unchanged, as seen in execution_table step 2.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the output of UPPER('Hello World') at step 1?
A'Hello World'
B'hello world'
C'HELLO WORLD'
D'HELLO world'
💡 Hint
Check the Output column in execution_table row with Step 1.
At which step does LOWER function produce 'hello world'?
AStep 2
BStep 3
CStep 1
DNo step
💡 Hint
Look at the Function and Output columns in execution_table.
If the input string was 'SQL123!', what would UPPER('SQL123!') return?
A'sql123!'
B'SQL123!'
C'SQL123!' with numbers changed
D'sql123!' with symbols changed
💡 Hint
Recall from key_moments that numbers and symbols do not change.
Concept Snapshot
UPPER(string) converts all letters to uppercase.
LOWER(string) converts all letters to lowercase.
Non-letter characters stay unchanged.
Use in SELECT queries to format text output.
Example: SELECT UPPER('abc') returns 'ABC'.
Full Transcript
The UPPER and LOWER functions in SQL take a text string and convert all alphabetic characters to uppercase or lowercase respectively. Non-letter characters like numbers, spaces, and punctuation remain unchanged. For example, UPPER('Hello World') returns 'HELLO WORLD', and LOWER('Hello World') returns 'hello world'. These functions are useful to standardize text data in queries. The execution table shows each step: applying UPPER and LOWER to the input string and the final query result. Beginners often wonder why numbers or symbols do not change; this is because these functions only affect letters. The visual quiz tests understanding of outputs at each step and behavior with different inputs.