📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials PostgreSQL Essentials String Functions

String Functions

5 min read
String functions: UPPER(), LOWER(), TRIM(), SUBSTRING(), REPLACE(), and SPLIT_PART(). Use || to concatenate. SPLIT_PART('alice@example.com', '@', 1) returns 'alice'. ILIKE for case-insensitive pattern matching.

String Manipulation

SELECT LENGTH(name) FROM users;
SELECT UPPER(name), LOWER(email) FROM users;
SELECT TRIM('  hello  ');          -- 'hello'
SELECT SUBSTRING(name, 1, 3) FROM users;
SELECT name || ' - ' || email FROM users; -- concat
SELECT REPLACE(name, 'a', '@') FROM users;
SELECT SPLIT_PART(email, '@', 2) FROM users; -- domain