0
0
Snowflakecloud~5 mins

Querying historical data (AT, BEFORE) in Snowflake - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the AT clause do in Snowflake time travel queries?
The AT clause lets you query the exact state of a table at a specific point in time in the past.
Click to reveal answer
intermediate
How does the BEFORE clause differ from AT in Snowflake?
BEFORE returns the state of the data just before a specified time or query ID, while AT returns the state exactly at that time.
Click to reveal answer
beginner
What is the maximum time travel retention period in Snowflake by default?
By default, Snowflake retains historical data for 1 day (24 hours) for time travel queries.
Click to reveal answer
intermediate
Write a simple Snowflake query to get the state of a table named orders exactly 2 hours ago.
SELECT * FROM orders AT (TIMESTAMP => DATEADD(hour, -2, CURRENT_TIMESTAMP()));
Click to reveal answer
beginner
Why is querying historical data useful in cloud data warehouses like Snowflake?
It helps recover lost or changed data, audit changes, and analyze past states without restoring backups.
Click to reveal answer
What does the AT clause in Snowflake time travel do?
ADeletes data at a specified time
BShows data before a specified past time
CShows current data only
DShows data exactly at a specified past time
Which clause returns data just before a specified time in Snowflake?
AAT
BSINCE
CBEFORE
DAFTER
What is the default time travel retention period in Snowflake?
A12 hours
B24 hours
C1 hour
D7 days
Which of these is a valid Snowflake query to get data 30 minutes ago?
ASELECT * FROM table AT (TIMESTAMP => DATEADD(minute, -30, CURRENT_TIMESTAMP()));
BSELECT * FROM table BEFORE (TIMESTAMP => DATEADD(minute, -30, CURRENT_TIMESTAMP()));
CSELECT * FROM table SINCE (TIMESTAMP => DATEADD(minute, -30, CURRENT_TIMESTAMP()));
DSELECT * FROM table AFTER (TIMESTAMP => DATEADD(minute, -30, CURRENT_TIMESTAMP()));
Why use Snowflake time travel to query historical data?
ATo recover or audit past data states
BTo delete old data
CTo speed up current queries
DTo create new tables
Explain how you would use the AT and BEFORE clauses in Snowflake to query historical data.
Think about recovering data or auditing changes.
You got /3 concepts.
    Describe a real-life scenario where querying historical data with Snowflake time travel would be helpful.
    Imagine you lost some important data or want to check what changed.
    You got /3 concepts.