Relative Content

Tag Archive for sqlamazon-redshift

Is there a SQL feature to return the max value for every column?

Background: I have a unique setup with multiple tables, each with circa 1,600 columns, which I am trying to clean up (it creates benefits upstream). I know that around 80% of these columns will always be [NULL], but I need to know precisely which ones (millions of rows).

Is there an sql feature to return the max value for every column?

Background: I have a unique setup with multiple tables, each with circa 1,600 columns, which I am trying to clean up (it creates benefits upstream). I know that around 80% of these columns will always be [NULL] but I need to know precisely which ones (millions of rows).

Redshift – Replace Materialized View that has a dependent view

I’m attempting to replace a Redshift materialized view with a new table definition that has updated fields. Previously i would just DROP MATERIALIZED VIEW accounts and then immediately CREATE MATERIALIZED VIEW accounts and end users would be none-the-wiser. However, someone has created their own view based on my view. When i try to drop the original accounts view I get an error that it cant be dropped since there is a dependent view.

How to split the full name column into first, middle and last name columns in SQL redshift

We got a requirement in the redshift table to split the full name column into first_name, middle_name, last_name columns with the help of space in the string using the SQL script. Below is the sample data and expected output for the columns. The first_name and last_name are deriving fine but getting issues for the middle_namewe with the below SQL, it removes the strings in middle name which is the common in other two columns hence it is not working for a few scenarios below are examples