Skip to content Skip to sidebar Skip to footer
Showing posts with the label Amazon Redshift

Create A Lapsed Concept Based On Logic Across Every Row Per Id

I am trying to get to a lapsed_date which is when there are >12 weeks (ie. 84 days) for a given … Read more Create A Lapsed Concept Based On Logic Across Every Row Per Id

Partitioning Data In Sql On-demand With Blob Storage As Data Source

In Amazon Redshift there is a way to create a partition key when using your S3 bucket as a data sou… Read more Partitioning Data In Sql On-demand With Blob Storage As Data Source

Amazon Redshift Foreign Keys - Sort Or Interleaved Keys

We plan to import OLTP Relational tables into AWS Redshift. The CustomerTransaction table joins to… Read more Amazon Redshift Foreign Keys - Sort Or Interleaved Keys

How To Fetch Records Using Vertical Columns In Amazon Redshift

I need to fetch records between the date range given in two columns. My Table structure is like: CR… Read more How To Fetch Records Using Vertical Columns In Amazon Redshift

Create A Query To Check If Any Column In A Table Is Null

I have zero experience with SQL but am trying to learn how to validate tables. I am trying to see w… Read more Create A Query To Check If Any Column In A Table Is Null

Find Top 1000 Entries Along With Count And Rank From Table

I have a table with around 30 billions rows in Redshift with following structure, userid itemid … Read more Find Top 1000 Entries Along With Count And Rank From Table

Remove Duplicates From Comma Separated String (amazon Redshift)

I am using Amazon Redshift. I have a column in that string is stored as comma separated like Privat… Read more Remove Duplicates From Comma Separated String (amazon Redshift)

Deterministic Sort Order For Window Functions

I've a status table and I want to fetch the latest details. Slno | ID | Status | date 1 | … Read more Deterministic Sort Order For Window Functions

Redshift Extract String Between Two Patterns (regexp_substr)

I'm trying to extract the text following deviceSerialNumber= that occurs until either a & o… Read more Redshift Extract String Between Two Patterns (regexp_substr)

Ranking Values To Determine Highest Value

I have data that looks as such: +-----+--------+--------+--------+ | ID | score1 | score2 | score3… Read more Ranking Values To Determine Highest Value

Find Earliest Created Record From Each Day

I am trying to find the earliest created_at record by day in a Redshift database: Ideally this wou… Read more Find Earliest Created Record From Each Day

Redshift: Add Column If Not Exists

The following works in Postgres 9.6 but not in Redshift: ALTER TABLE stats ADD COLUMN IF NOT EX… Read more Redshift: Add Column If Not Exists

Fetch Rows Based On Condition

I am using PostgreSQL on Amazon Redshift. My table is : drop table APP_Tax; create temp table APP… Read more Fetch Rows Based On Condition

How To Remove Non-numeric Characters (except Full Stop "." ) From A String In Amazon Redshift

I have been trying to figure out how to remove multiple non-numeric characters except full stop (&… Read more How To Remove Non-numeric Characters (except Full Stop "." ) From A String In Amazon Redshift

Hex String To Integer Conversion In Amazon Redshift

Amazon Redshift is based on ParAccel which is based on Postgres. From my research it seems that the… Read more Hex String To Integer Conversion In Amazon Redshift

Issue With Passing Column Name As A Parameter To "prepare" In Redshift

I am using REDSHIFT for the below question, Here is problem and I am looking for solution. I have 2… Read more Issue With Passing Column Name As A Parameter To "prepare" In Redshift

How To Get The Local Timezone Given Time And State Info

I am using a combination of Python and Amazon Redshift. I have hits from various users and some dat… Read more How To Get The Local Timezone Given Time And State Info

Cohort Analysis With Amazon Redshift / Postgresql

I'm trying analyze user retention using a cohort analysis based on event data stored in Redshif… Read more Cohort Analysis With Amazon Redshift / Postgresql

How Can I Write This Postgres Query In Amazon Redshift Such That It Is As Optimized As It Was In Postgres?

Here is my original query that I was using in postgres - SELECT a.id, (SELECT val FROM d… Read more How Can I Write This Postgres Query In Amazon Redshift Such That It Is As Optimized As It Was In Postgres?

Fix The Mau Problem While Calculating Dau And Mau On Amazon Redshift

I am using the following query to calculate MAU and DAU, according to this post: WITH dau AS ( SE… Read more Fix The Mau Problem While Calculating Dau And Mau On Amazon Redshift