Jump to: navigation, search

PostgreSQL BTRIM

From w3cyberlearnings

Contents

Postgresql btrim

This function removes whitespace or specific character from begining and end of a string. It is similar to trim() function.

Syntax btrim

btrim(string)

Example 1

test2=# SELECT btrim('   girl   '), '(        girl   )' as girl;
 btrim |       girl        
-------+-------------------
 girl  | (        girl   )
(1 row)

Example 2

Remove the whitespace in both side of the first name.

test2=# SELECT user_firstname,
test2-# btrim(user_firstname) 
test2-# FROM profile;
 user_firstname | btrim 
----------------+-------
 Jim            | Jim
 king           | king
 Jammi          | Jammi
 Bob            | Bob
                | 
(5 rows)

Related Links


Navigation
Web
SQL
MISC
References