ALTER TABLE table_name
ALTER COLUMN column_name
DROP NOT null
Back
Landing page
Front
count(distinct(page.pagePath))
FROM ...
CROSS JOIN UNNEST(hits)
Back
Assign new sessions
Front
CASE WHEN EXTRACT('EPOCH' FROM occurred_at) - EXTRACT('EPOCH' FROM last_event) >= (60 * 10)
OR last_event IS NULL
THEN 1 ELSE 0 END AS is_new_session
Back
Percentages with CASE and AVG
Front
AVG(CASE WHEN x THEN 1
WHEN y THEN 0...
Back
Insert Into
Front
INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
Back
Add a null constraint to a new table
Front
CREATE TABLE table_name (column_name data_type not null)
Back
Create Bins
Front
WITH bins AS (
SELECT generate_series(lowest, highest, increment) AS lower,
generate_series(lowest, highest, increment) AS upper)
SELECT lower, upper, count(...)
FROM bins
LEFT JOIN ...
ON ... >= lower
and ... < UPPER
group by lower, upper