Deal of The Day! 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-R01 Topic 4 Question 21 Discussion

Actual exam question for Snowflake's ARA-R01 exam
Question #: 21
Topic #: 4
[All ARA-R01 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:

Amie
10 months ago
Wait, wait, wait... Did they just casually mention 'APPEND_ONLY' like it's no big deal? That's the key to this whole question, I can feel it. Time to put on my thinking cap and work this out!
upvoted 0 times
Hillary
9 months ago
So, the correct answer would be B) 2 & 3.
upvoted 0 times
...
Harris
10 months ago
For the second SELECT COUNT (*) FROM STREAM_2, I believe the output would be 3.
upvoted 0 times
...
Nobuko
10 months ago
I think the output for the first SELECT COUNT (*) FROM STREAM_1 would be 2.
upvoted 0 times
...
...
Jerry
10 months ago
Oh boy, this one's got me stumped. I'll just go with my gut and hope for the best. Maybe I'll get lucky and the answer will be 'C' - that's always a safe bet, right?
upvoted 0 times
Anglea
9 months ago
I'm not sure about the answer, but let's see if 'C' is correct.
upvoted 0 times
...
Kati
10 months ago
I believe the output for the second SELECT statement would be 3.
upvoted 0 times
...
Nathan
10 months ago
I think the output for the first SELECT statement would be 2.
upvoted 0 times
...
...
Timmy
10 months ago
Hmm, I see your point. Let's think about the operations and try to figure it out.
upvoted 0 times
...
Willis
10 months ago
Hey, did you hear about the SQL developer who left his job? Apparently, he just couldn't handle all the table-turning situations anymore. Haha, get it? Table-turning? Oh, nevermind...
upvoted 0 times
Sommer
9 months ago
Let's see if the streams capture the changes correctly.
upvoted 0 times
...
Mariko
9 months ago
I believe the output will be D) 4 & 6.
upvoted 0 times
...
Buck
9 months ago
I think the output would be A) 2 & 6.
upvoted 0 times
...
Miesha
10 months ago
Haha, that's a good one!
upvoted 0 times
...
...
Myrtie
11 months ago
I disagree, I believe it would be 4 & 3.
upvoted 0 times
...
Timmy
11 months ago
I think the output would be 2 & 6.
upvoted 0 times
...
Annabelle
11 months ago
Hmm, looks like we're dealing with some data streaming here. I'm thinking the APPEND_ONLY stream should have more records than the regular stream, but let's see what the experts say.
upvoted 0 times
Ira
10 months ago
No, I believe it would be 4 for STREAM_1 and 3 for STREAM_2.
upvoted 0 times
...
Meaghan
10 months ago
I think the output would be 2 for STREAM_1 and 6 for STREAM_2.
upvoted 0 times
...
...

Save Cancel