How to get the first character of a string in Redshift database

Use SUBSTRING function to get the first character of a string in Redshift database.

Syntax:

select substring('string',starting position,number of characters);
select substring('your string here',1,1) ; --First character
select substring('your string here',1,2) ; --First 2 characters
select substring('your string here',2,1) ; --Second character
select substring('your string here',2) ; --Everything except first character
select substring('your string here',4,8); -- 8 characters starting from 4th position
See also  How to resolve 'ALTER TABLE ALTER COLUMN cannot run inside a transaction block' in Redshift