Querying historical data (AT, BEFORE)
📖 Scenario: You work as a data analyst for a retail company. The company uses Snowflake to store sales data. You want to learn how to query the sales table to see what the data looked like at a specific point in time or before that time.
🎯 Goal: Build a Snowflake SQL query that retrieves sales data as it existed at a specific timestamp and before a specific timestamp using the AT and BEFORE clauses.
📋 What You'll Learn
Create a table called
sales with columns sale_id (integer), product (string), and amount (number).Insert sample sales data with at least 3 rows.
Write a query to select all sales data
AT a specific timestamp.Write a query to select all sales data
BEFORE a specific timestamp.💡 Why This Matters
🌍 Real World
Companies often need to see how their data looked at a past point in time to audit changes or recover lost data.
💼 Career
Knowing how to query historical data is important for data analysts and engineers working with Snowflake or other cloud data warehouses.
Progress0 / 4 steps