PostgreSQL STRING CONCATE
From w3cyberlearnings
Contents |
Postgresql ||
Concatenate string together.
Syntax ||
- string1 is a string or any character symbol
- string2 is a string or any character symbol
- string3 is a string or any character symbol
- something (optional) is a display column alias
string1 || string2 || string3 something
Example 1
test2=# SELECT 'girl'||' ' || 'boy' as kids; kids ---------- girl boy (1 row)
Example 2
test2=# SELECT * FROM profile; user_id | user_firstname | user_lastname | user_age ---------+----------------+---------------+---------- 2 | Jim | Jkim | 32 3 | king | queen | 29 4 | Jammi | weeks | 23 1 | Bob | Mark | 45 (5 rows) test2=# SELECT user_id, test2-# user_firstname || ' ' || user_lastname as fullname, test2-# user_age test2-# FROM profile; user_id | fullname | user_age ---------+-------------+---------- 2 | Jim Jkim | 32 3 | king queen | 29 4 | Jammi weeks | 23 1 | Bob Mark | 45
Related Links
- string concate
- bit_length
- char_length
- character_length
- lower
- octet_length
- overlay
- position
- substring
- trim
- upper
- ascii
- btrim