Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Data set up script for dankleiman.com/2019/09/27/sql-quick-tip-showing-changes-in-your-data/
CREATE TABLE daily_metrics AS (
SELECT date, metric, count FROM (SELECT '2019-09-01', 'A', 115) as r(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-02', 'A', 98) as r2(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-03', 'A', 268) as r2(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-04', 'A', 451) as r4(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-05', 'A', 239) as r5(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-06', 'A', 75) as r6(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-07', 'A', 306) as r7(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-01', 'B', 38) as r8(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-02', 'B', 14) as r9(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-03', 'B', 77) as r10(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-04', 'B', 203) as r11(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-05', 'B', 251) as r12(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-06', 'B', 300) as r13(date, metric, count)
UNION
SELECT date, metric, count FROM (SELECT '2019-09-07', 'B', 165) as r14(date, metric, count)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.