PostgreSQLString FunctionsLEFT
SUBSTRING

LEFTString Functions

RIGHT

Returns the leftmost n characters.

Syntax

LEFT(str, n)

Example

Enter values below to update the example in real time.

product_code
category_code
products
SELECT LEFT(product_code, 4) AS category_code
FROM products;