Introduction to Redshift
Jason Myers
Principal Architect
Leader Node
Compute Node
-- Selecting the substr, starting at
-- position 11 of 'chocolate chip'
SELECT SUBSTR('chocolate chip', 11);
chip
SUBSTRING
SUBSTR
errors on table columns-- Selecting the substr from position 1
-- of the column named field on table
SELECT SUBSTR(field, 1) FROM table;
ERROR: SUBSTR() function is not
supported (Hint: use SUBSTRING
instead)
SELECT host,
-- Calculate the percentage of used space
-- using the used minus tossed or ready to be reclaimed
-- divided by the capacity
(used - tossed) / capacity * 100 as percent_used
FROM STV_PARTITIONS;
host | percent_used
======+==============
0 | 24.9
1 | 24.8
SELECT table_A.columnX,
table_B.columnY,
FROM table_A
INNER JOIN table_B
-- predicate
ON table_B.foreign_key = table_A.primary_key
-- predicate
WHERE table_B.columnZ = 'value';
MetaData Catalog
Query Engine
Storage
AWS Glue Data Catalog
AWS S3 Bucket
Introduction to Redshift