SQL Nested Functions Challenge Set – Easy, Medium & Hard Unisoft
Comprehensive SQL Challenge Set (Easy → Medium → Hard)
Each level progressively increases in difficulty, requiring multiple nested functions.
🟢 Easy Level
- Retrieve employees whose names have exactly 5 characters, converted to uppercase, and sorted by salary.
Hint: Use
LENGTH(),UPPER(), andORDER BY SAL. - Display employees whose names contain the letter 'A', replacing all occurrences of 'A' with '@', trimmed to remove spaces.
Hint: Use
INSTR(),REPLACE(),TRIM(), andORDER BY JOB.
🟡 Medium Level
- Extract the last three characters of each employee’s name, concatenate them with the job title, and convert the result to title case (InitCap) while removing leading spaces.
Hint: Use
SUBSTR(),LTRIM(),CONCAT(), andINITCAP(). - Replace all vowels in employee names with '#', then pad the result with '@' to make every name exactly 10 characters long, sorted by department number.
Hint: Use
TRANSLATE(),LPAD(),LENGTH(), andORDER BY DEPTNO.
🔴 Hard Level
- Extract the middle three characters of an employee’s name (if the length is odd) or middle four characters (if the length is even), replace all vowels in this substring with '#', and order by salary in descending order.
Hint: Use
SUBSTR(),TRANSLATE(),LENGTH(),RPAD(), andORDER BY SAL DESC. - Retrieve employees whose job title contains more than 6 characters, trim spaces, reverse the name, and concatenate it with the reversed job title.
Hint: Use
RTRIM(),SUBSTR(),INSTR(),CONCAT(), andORDER BY JOB.
🚀 Happy Querying! 🚀