Skip to content
Advertisement

Tag: amazon-redshift

How best can I to pivot my redshift table?

I have a Redshift table called metadata with the following columns: id key value 1001 code1 my value 1001 code2 another 1001 code3 yet another 1002 code1 new one 1002 code2 here 1002 code3 last 1003 code1 hello 1003 code2 goodbye 1004 code2 now 1004 code3 then I’d like to have a query that return it as: id code1 code2

SQL extracting date substring using regexp_subtr

I’ve got a field named signal_notes containing strings like the follow (this would be a single value of signal_notes): Sometimes, the ^expiry_date^ line will have a date between the ^’s in the format ‘YYYY-MM-DD’. My new field expiry_date will ideally be in the format ‘YYYY-MM-DD’ with the date string from the signal_notes field. This is what I’ve got so far,

Find missing entries by date

I have two redshift tables: alert_type: where i keep types of alerts in my system alert: where i keep alerts Every day I generate a new alert for each alert type. If something has failed in …

Advertisement