Skip to content

Instantly share code, notes, and snippets.

Decimal Binary
------- ------
0 0000000000000000
205 0000000011001101 Interleave the min(compressed_val) for each
205 0000000011001101 sort key column and we get the min(minvalue)
0 0000000000000000 from stv_blocklist
-------------------------------------------------------------------------------
1711302150 0000000000000000000000000000000001100110000000000110011000000110
1023 0000001111111111
@ajw0100
ajw0100 / snowflake.sql
Created August 24, 2015 21:49
Documenting Your Snowflake Data Warehouse
create table orders(id int) comment='This is table holds all customer orders!';
@ajw0100
ajw0100 / mssql.sql
Created August 24, 2015 21:48
Documenting Your Microsoft SQL Server Data Warehouse
create table orders (
id int
)
go
declare @CurrentUser sysname
select @CurrentUser = user_name()
execute sp_addextendedproperty 'MS_Description',
'This table holds all customer orders!',
'user', @CurrentUser, 'table', 'orders'
@ajw0100
ajw0100 / oracle.sql
Created August 24, 2015 21:47
Documenting Your Oracle Data Warehouse
create table orders (id int);
comment on table orders is 'This table holds all customer orders!';
select comments
from user_tab_comments
where table_name='orders';
┌───────────────────────────────────────┐
│ comments |
├───────────────────────────────────────┤
@ajw0100
ajw0100 / mysql.sql
Created August 24, 2015 21:46
Documenting Your MySQL Data Warehouse
create table orders(id int) comment="This table holds all customer orders!";
select table_comment
from information_schema.tables
where table_name='orders';
┌───────────────────────────────────────┐
│ table_comment │
├───────────────────────────────────────┤
│ This table holds all customer orders! │
└───────────────────────────────────────┘
@ajw0100
ajw0100 / redshift.sql
Created August 24, 2015 21:46
Documenting Your Redshift Data Warehouse
create table orders(id int);
comment on table orders is 'This table holds all customer orders!';
select description from pg_description
join pg_class on pg_description.objoid = pg_class.oid
where relname = 'orders';
┌───────────────────────────────────────┐
│ description │
├───────────────────────────────────────┤
@ajw0100
ajw0100 / postgres.sql
Created August 24, 2015 21:44
Documenting Your PostgreSQL Data Warehouse
create table orders(id int);
comment on table orders is 'This table holds all customer orders!';
select description from pg_description
join pg_class on pg_description.objoid = pg_class.oid
where relname = 'orders';
┌───────────────────────────────────────┐
│ description │
├───────────────────────────────────────┤
with
years(year_id, year) as (
select i, 'Year ' || i
from generate_series(0, 3) i
),
regions(region_id, region) as (
select i, 'Region ' || i
from generate_series(0, 3) i
explain
select
count(t1.user_id) as viewed_homepage,
count(distinct t2.user_id) as used_demo,
count(distinct t3.user_id) as entered_credit_card
from (
select
user_id,
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Example aliases