How to export data from Redshift database to a csv file

Use the ‘unload‘ command as shown below to extract data from Redshift database to a csv file.

unload ('SELECT * from schemaname.tablename')
TO 's3://bucketname/filename'
iam_role 'arn-of-iam-role'
CSV

See also  How to change EBS volume type