postgresql concat string with separator 1

postgresql concat string with separator

SELECT
	concat_ws (', ', last_name, first_name) AS full_name
FROM
	customer
ORDER BY
	last_name;Code language: SQL (Structured Query Language) (sql)

Here is what the above code is Doing:
1. We’re using the concat_ws() function to concatenate the last_name and first_name columns.
2. We’re using the AS keyword to rename the concatenated column to full_name.
3. We’re using the ORDER BY clause to sort the results by the last_name column.

Similar Posts