Filter
Exclude
Time range
-
Near
Apr 24
➤ Real World RPAD Uses: -- Format report columns with consistent width: SELECT RPAD(name, 15, ' ') || RPAD(city, 15, ' ') || RPAD(dept, 10, ' ') AS report_line FROM employees; Output: Report Line Raj Delhi Finance Priya Mumbai IT Arjun Delhi Finance • Everything aligned perfectly like a report! ➤ Quick Summary: • TRIM() = removes spaces or characters from both sides • TRIM(char FROM string) = removes specific character from both sides • TRIM LEADING = left side only, TRIM TRAILING = right side only • LTRIM() = removes characters from LEFT keeps removing while left char is in list • RTRIM() = removes characters from RIGHT - same logic • Combine LTRIM RTRIM to remove from both sides for specific chars • REPLACE(string, find, replace) = replaces ALL occurrences • REPLACE with empty string = deletes the search string • LPAD(string, length, char) = pads LEFT to reach total length • RPAD(string, length, char) = pads RIGHT to reach total length • If string is longer than total_length - LPAD/RPAD truncate it #OracleSQL #TRIM #LTRIM #RTRIM #REPLACE #LPAD #RPAD #CharacterFunctions #LearnSQL #Day22 #100DaysOfCode #TechTwitter
2
44
Apr 22
➤ Most Important Use - Case Insensitive Search! Remember Oracle data is case sensitive. These functions solve that! -- Problem: You don't know if city is stored as -- 'Delhi', 'DELHI', 'delhi', 'dElHi' -- ❌ This might miss results: WHERE city = 'Delhi' -- ✅ This finds regardless of how it's stored: WHERE LOWER(city) = 'delhi' WHERE UPPER(city) = 'DELHI' -- Real Example — user types city in any case: SELECT name, city FROM employees WHERE UPPER(city) = UPPER('&enter_city'); -- User types 'delhi', 'DELHI', 'Delhi' → all work! ✅ ➤ Using Functions in ORDER BY: -- Sort by name case-insensitively: SELECT name FROM employees ORDER BY LOWER(name); ➤ Quick Summary: • Single Row Functions = work on one row at a time - return one result per row • Group Functions = work on multiple rows - return one result total (covered later) • Four categories - Character, Numeric, Date, Conversion • LOWER() = converts entire string to lowercase • UPPER() = converts entire string to uppercase • INITCAP() = first letter of each word uppercase, rest lowercase • Most important use = case-insensitive search using UPPER() or LOWER() in WHERE clause • Functions can also be used in ORDER BY clause #OracleSQL #SingleRowFunctions #UPPER #LOWER #INITCAP #CharacterFunctions #LearnSQL #SQLBeginners #Day20 #100DaysOfCode #TechTwitter
3
54