BlackFriday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Snowflake Exam ARA-C01 Topic 5 Question 23 Discussion

Actual exam question for Snowflake's ARA-C01 exam
Question #: 23
Topic #: 5
[All ARA-C01 Questions]

A new table and streams are created with the following commands:

CREATE OR REPLACE TABLE LETTERS (ID INT, LETTER STRING) ;

CREATE OR REPLACE STREAM STREAM_1 ON TABLE LETTERS;

CREATE OR REPLACE STREAM STREAM_2 ON TABLE LETTERS APPEND_ONLY = TRUE;

The following operations are processed on the newly created table:

INSERT INTO LETTERS VALUES (1, 'A');

INSERT INTO LETTERS VALUES (2, 'B');

INSERT INTO LETTERS VALUES (3, 'C');

TRUNCATE TABLE LETTERS;

INSERT INTO LETTERS VALUES (4, 'D');

INSERT INTO LETTERS VALUES (5, 'E');

INSERT INTO LETTERS VALUES (6, 'F');

DELETE FROM LETTERS WHERE ID = 6;

What would be the output of the following SQL commands, in order?

SELECT COUNT (*) FROM STREAM_1;

SELECT COUNT (*) FROM STREAM_2;

Show Suggested Answer Hide Answer
Suggested Answer: C

In Snowflake, a stream records data manipulation language (DML) changes to its base table since the stream was created or last consumed. STREAM_1 will show all changes including the TRUNCATE operation, while STREAM_2, being APPEND_ONLY, will not show deletions like TRUNCATE. Therefore, STREAM_1 will count the three inserts, the TRUNCATE (counted as a single operation), and the subsequent two inserts before the delete, totaling 4. STREAM_2 will only count the three initial inserts and the two after the TRUNCATE, totaling 3, as it does not count the TRUNCATE or the delete operation.


Contribute your Thoughts:

Laticia
6 months ago
I think the answer is option C) 4 & 3.
upvoted 0 times
...
Cherilyn
6 months ago
I'm not sure about the first query, but I think the second query should return 6.
upvoted 0 times
...
Eric
6 months ago
I believe the output of the second query is 3.
upvoted 0 times
...
Lashaun
7 months ago
I think the output of the first query is 2.
upvoted 0 times
Mira
6 months ago
C
upvoted 0 times
...
Mira
6 months ago
What happened to stream 2?
upvoted 0 times
...
Mira
6 months ago
A
upvoted 0 times
...
...
Ezekiel
7 months ago
Wait, hold up. Are we sure the TRUNCATE operation doesn't affect the APPEND_ONLY stream? I've heard some weird things about how that works, and I'm not entirely convinced the answer is that straightforward.
upvoted 0 times
...
Deeanna
7 months ago
I don't know, man. This streaming stuff is confusing. I'm just going to guess C and hope for the best. Maybe I should have studied more instead of binge-watching that new show on Netflix last night.
upvoted 0 times
...
Elli
7 months ago
You guys are overthinking this. The question is pretty straightforward – the TRUNCATE clears the table, so the first stream should only have the last 2 inserts, and the second stream should have all 6 inserts. The answer is D, 4 and 6.
upvoted 0 times
...
Stephaine
7 months ago
Hold on, I'm not so sure about that. Doesn't the TRUNCATE operation also affect the streams? I'm thinking the counts should be 4 and 3, since the first stream would have all the records, and the second stream would only have the last 3 inserts.
upvoted 0 times
...
Cory
7 months ago
Hmm, I think I've got an idea. The TRUNCATE operation should clear the table, but the APPEND_ONLY stream should still have all the previous records, right? So the counts should be 2 and 6 for the two streams.
upvoted 0 times
...
Luisa
8 months ago
Whoa, this question is tricky! I'm not sure I fully understand how the APPEND_ONLY flag works for the streams. Does that mean the second stream will only ever grow and never shrink, even after a TRUNCATE operation? This is going to be a tough one to figure out.
upvoted 0 times
...

Save Cancel