By Rohit Ray · Independent educational lesson · Explore this visual lab

Module 12 · Lesson 5 of 9Detailed study · about 20 min

Follow inserts, updates and deletes through the pipeline

A refreshed dynamic table represents the current result of its defining query, not a permanent record of every source event.

Understand the idea

Change order 101 from 100 to 120 and delete order 102. Add a paid B order worth 40. After refresh, customer A should have one order worth 120 and B one worth 40.

Key ideas in simple English
ConceptWhat it means
InsertA newly qualifying source row appears.
UpdateChanged values affect derived output.
DeleteA removed source row leaves the result.
Filter transitionA row can leave without a physical source deletion.

A concrete example

Change order 101 from 100 to 120 and delete order 102. Add a paid B order worth 40. After refresh, customer A should have one order worth 120 and B one worth 40.

Remember: Compare the output with the query’s filtering rules; a correct transformation can intentionally remove rows.

Explain it step by step · full theory

Understand the concept

Change order 101 from 100 to 120 and delete order 102. Add a paid B order worth 40. After refresh, customer A should have one order worth 120 and B one worth 40.

This is a prediction you can compare with actual output. Querying too early may show the previous successful result. Confirm that the refresh covering the changes succeeded instead of repeatedly rewriting source data.

Apply it to our pipeline

A cancelled row remains in RAW_ORDERS but is excluded from CLEAN_ORDERS. That distinction matters when reconciling counts: three raw rows can correctly produce two clean rows.

Dynamic tables maintain query results. If you need every intermediate business event or external action, retain an event source and explicit processing contract rather than treating these stored snapshots as a complete audit log.

Words used in this lesson
Insert
A newly qualifying source row appears.
Update
Changed values affect derived output.
Delete
A removed source row leaves the result.
Filter transition
A row can leave without a physical source deletion.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 2

Follow inserts, updates and deletes through the pipeline

RAW_ORDERS
CLEAN_ORDERS
CUSTOMER_TOTALS

Read the dependency

A refreshed dynamic table represents the current result of its defining query, not a permanent record of every source event.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Read the dependency

    A refreshed dynamic table represents the current result of its defining query, not a permanent record of every source event.

  2. Observe the result

    After a successful refresh: clean rows 101/A/120 and 104/B/40; totals A/1/120 and B/1/40. Raw order 103 is still cancelled.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Manual Snowflake practice only. This website does not run SQL or provision compute. Refreshing dynamic tables uses billable resources.

Follow inserts, updates and deletes through the pipeline — manual SQL

Definition: A refreshed dynamic table represents the current result of its defining query, not a permanent record of every source event.

When to use: Practise in the isolated M12_LAB schema.

Example: After a successful refresh: clean rows 101/A/120 and 104/B/40; totals A/1/120 and B/1/40. Raw order 103 is still cancelled.

SQL · example
UPDATE RAW_ORDERS SET AMOUNT=120 WHERE ORDER_ID=101;
DELETE FROM RAW_ORDERS WHERE ORDER_ID=102;
INSERT INTO RAW_ORDERS VALUES (104,'B',40,'PAID');
ALTER DYNAMIC TABLE CUSTOMER_TOTALS REFRESH;
SELECT * FROM CLEAN_ORDERS ORDER BY ORDER_ID;
SELECT * FROM CUSTOMER_TOTALS ORDER BY CUSTOMER_ID;

What to expect and why

After a successful refresh: clean rows 101/A/120 and 104/B/40; totals A/1/120 and B/1/40. Raw order 103 is still cancelled.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Must raw and clean row counts always match?

Try it yourself

Explain why: Must raw and clean row counts always match?

Compare your reasoning

Compare the output with the query’s filtering rules; a correct transformation can intentionally remove rows.

Official sources and curriculum

Module 12 · See module scope