Run the below command to get current month from current date in Redshift database. For current date: select CURRENT_DATE; For
Continue readingHow to get yesterday’s date in Redshift database
Use the getdate function to get today’s date. Add or Subtract days as required from today’s date. Example, to get
Continue readingHow to list all objects that are dependent on a table in Redshift
Run the below query to view all the dependent objects of a table in Redshift where schemaname and tablename are
Continue readingHow to get the ddl of a view in Redshift database
DDL of views can be obtained from information_schema.views. Below is the sql to get the view definition where schemaname is
Continue readingHow to list all views in a Redshift database
Run the below query to list all the non-system views in a Redshift database. select table_schema, table_name from information_schema.views where
Continue readingHow to add multiple columns to a table in Redshift
Below is the syntax to add a new column to an existing table in Redshift. alter table schemaname.tablename add columnname
Continue readingHow to view the sql history(recent queries) of a user in Redshift
Use the below sql statement to view the recent 100 queries run by a user ordered by the most recent
Continue readingS3 Cheat Sheet
Simple Storage Service Unlimited storage Pay as you use Read after write consistency for PUTS Eventual consistency for overwrite puts
Continue readingHow to resolve ‘ALTER TABLE ALTER COLUMN cannot run inside a transaction block’ in Redshift
You might encounter the below error while trying to modify a column in Redshift database from SQL Workbench. [Amazon](500310) Invalid
Continue readingHow to change the distribution style of a table in Redshift database
You can modify the distribution style of a table using below sql command: alter table tablename alter diststyle AUTO|ALL|EVEN|KEY DISTKEY
Continue reading