Greg Trzeciak from Pragmatic Works introduces beginners to the essentials of querying data in Snowflake. This guide walks through creating your first SQL query, understanding Snowflake’s interface, and applying best practices for performance optimization.
Before diving into queries, Greg emphasizes the importance of setting up your environment:
Greg highlights critical components that impact query success:
The first query uses the classic SELECT * statement:
SELECT *
FROM SNOWFLAKE_SAMPLE_DATA.TPC.CUSTOMER
LIMIT 10;
This retrieves 10 rows from the customer table in the sample dataset, providing a quick preview without consuming excessive compute resources.
To refine results, Greg introduces the WHERE clause and column selection:
SELECT C_NAME, C_ADDRESS
FROM SNOWFLAKE_SAMPLE_DATA.TPC.CUSTOMER
WHERE C_MKTSEGMENT = 'AUTOMOBILE';
This query filters customers by market segment and limits columns to name and address for clarity.
Sorting adds structure to your output. Greg demonstrates:
SELECT C_NAME, C_ADDRESS
FROM SNOWFLAKE_SAMPLE_DATA.TPC.CUSTOMER
WHERE C_MKTSEGMENT = 'AUTOMOBILE'
ORDER BY C_CUSTKEY;
The ORDER BY clause organizes results by customer key, making data easier to interpret.
Greg showcases how warehouse size impacts query speed:
While larger warehouses deliver faster results, they also increase costs. Balance performance needs with budget considerations.
LIMIT for quick previews and to conserve compute resources.Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on SQL SnowFlake and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.