100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Snowflake SQL Cheat Sheet

Snowflake SQL Cheat Sheet

Snowflake SQL and warehouse management covering virtual warehouses, semi-structured data, time travel, and Snowpark basics.

2 PagesIntermediateJan 30, 2026

Virtual Warehouse Management

Create and manage the compute layer, independent of storage.

sql
CREATE WAREHOUSE IF NOT EXISTS etl_wh  WAREHOUSE_SIZE = 'MEDIUM'  AUTO_SUSPEND = 60  AUTO_RESUME = TRUE  INITIALLY_SUSPENDED = TRUE;USE WAREHOUSE etl_wh;ALTER WAREHOUSE etl_wh SET WAREHOUSE_SIZE = 'LARGE';-- Multi-cluster warehouse for high concurrencyALTER WAREHOUSE etl_wh SET  MIN_CLUSTER_COUNT = 1  MAX_CLUSTER_COUNT = 4  SCALING_POLICY = 'STANDARD';

Semi-Structured Data (VARIANT)

Query JSON directly without a rigid schema using VARIANT and dot/colon notation.

sql
CREATE TABLE events (raw VARIANT);INSERT INTO eventsSELECT PARSE_JSON('{"user": {"id": 42, "tier": "gold"}, "amount": 19.99}');SELECT    raw:user.id::INT           AS user_id,    raw:user.tier::STRING      AS tier,    raw:amount::FLOAT          AS amountFROM events;-- Flatten nested arraysSELECT f.value:sku::STRING AS skuFROM events, LATERAL FLATTEN(input => raw:items) f;

Time Travel & Cloning

Query or restore historical data, and clone objects with zero-copy.

sql
-- Query a table as of 1 hour agoSELECT * FROM orders AT (OFFSET => -3600);-- Query as of a specific timestampSELECT * FROM orders AT (TIMESTAMP => '2026-06-01 00:00:00'::TIMESTAMP);-- Restore an accidentally dropped tableUNDROP TABLE orders;-- Zero-copy clone (instant, no extra storage until divergence)CREATE TABLE orders_dev CLONE orders;CREATE DATABASE analytics_dev CLONE analytics_prod;

Core Concepts

Snowflake's architecture terms you'll see constantly.

  • Virtual Warehouse- independently scalable compute cluster; storage and compute billed separately
  • Micro-partition- Snowflake's automatic, immutable storage unit (~16MB compressed) with built-in pruning metadata
  • Time Travel- query/restore historical table states within a retention window (1-90 days by edition)
  • Zero-copy cloning- instantly clone a table/schema/database without duplicating storage
  • Streams & Tasks- CDC-style change tracking (streams) paired with scheduled SQL execution (tasks) for pipelines
  • Snowpark- DataFrame API for Python/Scala/Java that pushes compute down into Snowflake warehouses
Pro Tip

Set AUTO_SUSPEND aggressively low (60 seconds) on warehouses used for ad-hoc or bursty workloads — Snowflake bills per-second of active compute, and warehouses left idle-but-running are one of the most common sources of surprise cost.

Was this cheat sheet helpful?

Explore Topics

#SnowflakeSQL#SnowflakeSQLCheatSheet#Database#Intermediate#VirtualWarehouseManagement#Semi#Structured#Data#Databases#CheatSheet#SkillVeris