Snowflake Explained: Database, Schema and Virtual Warehouse
Separate Snowflake storage objects from compute, run a small sales query, and understand why selecting the right warehouse and role matters.
What is the difference between a database and a warehouse?
A database and schema organize data objects such as tables and views. A virtual warehouse supplies compute for work such as querying and loading. These names describe different responsibilities: choosing a warehouse does not choose which business table you mean.
Think of a practice sales table inside a database named TRAINING and a schema named ANALYTICS. A selected warehouse provides compute to query that table, while the active role controls permissions. Storage, compute and access need separate attention.
A small read-only sales query
The following Snowflake SQL uses inline VALUES, so it does not create a permanent table. Use an authorized practice session with suitable compute and permissions. Running queries may consume account resources; this guide does not provision a warehouse.
WITH sales AS (
SELECT column1::VARCHAR AS channel,
column2::NUMBER(10,2) AS amount
FROM VALUES ('online', 120.00), ('store', 80.00), ('online', 30.00)
)
SELECT channel, SUM(amount) AS revenue
FROM sales GROUP BY channel ORDER BY channel;
Expected results: online 150.00 and store 80.00. Casting the columns makes the intended data types explicit. These three sample amounts illustrate aggregation, not company revenue figures.
Why do session settings matter?
When diagnosing a query, check the active role, warehouse, database and schema. A missing warehouse or insufficient permission is not the same issue as a misspelled table name. Fully qualifying a real table as database.schema.table makes the target clear, but does not grant access to it.
Do not switch to a highly privileged role merely to make an error disappear. Identify the permission needed for the task and follow the account's access process. Never paste account passwords or service keys into public teaching examples.
Does a larger warehouse always make a query faster?
Increasing compute can help some workloads, but a tiny query is not a meaningful sizing benchmark. Measure representative query time, queueing and consumption before making a change. A slow result can have causes beyond warehouse size, including the amount of data read or the shape of the query.
Auto-suspend and auto-resume help align warehouse activity with demand. Check the actual account settings rather than assuming that an idle warehouse has stopped. Cost and feature availability depend on the account and configuration; this introduction deliberately gives no universal price estimate.
A useful practice progression
First run the inline query and predict its total of 230. Add a store sale of 20 and explain why store becomes 100 while online remains 150. Next replace the example with a practice table you are permitted to read, using its fully qualified name.
Document the selected role and warehouse in your exercise notes without recording secrets. Compare a correct zero-row result with a permission error. For an interview, explain how you would distinguish a missing object, missing access and missing compute before proposing a fix.
Learning and official sources
Snowflake course.
Snowflake warehouse overview.
Snowflake VALUES reference.
AI Leaf Global Learn serves classroom learners in Mudichur/Tambaram, Chennai, and online learners across India. Confirm current course and batch details. Prepared by AI Leaf Global Learn. The SQL is reviewed against documentation and is not represented as executed in a live Snowflake account.