If you’re just getting started with querying data in Snowflake, this walkthrough will help you master the basics. From creating your first SQL worksheet to using sample data and understanding warehouse sizing, this post breaks down the key steps in a practical, easy-to-follow format.
The examples here are based on real class content, where you’ll write and run SQL queries using built-in Snowflake datasets. You’ll also learn how to refine results using WHERE filters, organize output with ORDER BY, and even optimize performance by adjusting your virtual warehouse.
For those looking to go further, there’s also a linked training resource at the end to help sharpen your skills.
Getting Set Up in Snowflake
Before writing your first query, you’ll need to:
- Log into your Snowflake instance
- Ensure your role is set to
ACCOUNTADMIN - Open a SQL Worksheet via the plus (+) icon on the left
- Choose or create a virtual warehouse (e.g., XS, S, M)
- Access the built-in SNOWFLAKE_SAMPLE_DATA database
This setup gives you everything you need to begin running SQL queries without loading any of your own data.
Step 1: View Sample Data with SELECT and LIMIT
To get a feel for Snowflake’s structure, begin by selecting a few rows from the sample CUSTOMER table:
SELECT *
FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER
LIMIT 10;
This query displays the first 10 rows and helps you explore the table’s structure without consuming excessive compute resources. Be sure to highlight the full query and click the Run button.
Expect your results in just a couple of seconds—especially if you’re using a smaller warehouse like XS.
Step 2: Use SELECT Columns with a WHERE Clause
Instead of selecting every column, refine your results by specifying which columns to include and filtering rows with a WHERE condition:
SELECT C_NAME, C_ADDRESS, C_PHONE
FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER
WHERE C_MKTSEGMENT = 'AUTOMOBILE';
This query returns only the customer name, address, and phone number, but only for rows where the market segment is “AUTOMOBILE”. You can swap out or exclude any columns you don’t need by editing the SELECT list.
Snowflake’s UI will also help by auto-suggesting column names as you type.
Step 3: Sort Results Using ORDER BY
To further organize your results, add an ORDER BY clause:
SELECT C_NAME, C_ADDRESS, C_PHONE
FROM SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER
WHERE C_MKTSEGMENT = 'AUTOMOBILE'
ORDER BY C_CUSTKEY;
Sorting results allows you to analyze data more effectively, whether you want to look at the earliest customer entries or track specific segments.
Bonus: Compare Warehouse Performance
One key feature in Snowflake is the ability to adjust your virtual warehouse size. For instance, running a query on an XS warehouse might take 791 milliseconds, while upgrading to a M warehouse could reduce it to just 59 milliseconds.
Keep in mind that higher warehouse sizes come with higher compute costs. It’s best to test performance and balance it against your budget.
Best Practices for Querying in Snowflake
- Start with sample data to practice before using production tables
- Avoid
SELECT *in production queries to reduce load times and costs - Use
LIMITwhen testing to avoid pulling full datasets - Apply
WHEREfilters early to keep results relevant - Sort using
ORDER BYonly when needed - Optimize performance by adjusting warehouse size for heavy queries
Continue Learning
By practicing these core SQL skills, you’ll build a solid foundation for querying data in Snowflake at scale in real-world scenarios..
You can dive deeper into querying and reporting by visiting DataBear’s Power BI Training, which offers real-world tutorials and interactive learning on related technologies.


