COF-C02 · Question #115
Which SQL commands, when committed, will consume a stream and advance the stream offset? (Choose two.)
The correct answer is A. UPDATE TABLE FROM STREAM C. INSERT INTO TABLE SELECT FROM STREAM. A Snowflake stream tracks DML changes (INSERT, UPDATE, DELETE) on a source table. A stream's offset advances - meaning the stream is consumed - only when the stream is read within a DML transaction that is successfully committed. Both 'UPDATE TABLE FROM STREAM' (A) and 'INSERT…
Question
Which SQL commands, when committed, will consume a stream and advance the stream offset? (Choose two.)
Options
- AUPDATE TABLE FROM STREAM
- BSELECT FROM STREAM
- CINSERT INTO TABLE SELECT FROM STREAM
- DALTER TABLE AS SELECT FROM STREAM
- EBEGIN COMMIT
How the community answered
(46 responses)- A91% (42)
- B4% (2)
- D2% (1)
- E2% (1)
Explanation
A Snowflake stream tracks DML changes (INSERT, UPDATE, DELETE) on a source table. A stream's offset advances - meaning the stream is consumed - only when the stream is read within a DML transaction that is successfully committed. Both 'UPDATE TABLE FROM STREAM' (A) and 'INSERT INTO TABLE SELECT FROM STREAM' (C) are DML operations that read from the stream within a committed transaction, so they advance the offset. A plain SELECT FROM STREAM (B) does not consume the stream. ALTER TABLE (D) is a DDL command and cannot use CREATE TABLE AS SELECT FROM STREAM syntax to consume a stream. BEGIN COMMIT (E) is not a valid single SQL command.
Topics
Community Discussion
No community discussion yet for this question.