ExamGecko
Question list
Search
Search

Question 701 - COF-C02 discussion

Report
Export

When working with table MY_TABLE that contains 10 rows, which sampling query will always return exactly 5 rows?

A.

SELECT * FROM MY_TABLE SAMPLE SYSTEM (5);

Answers
A.

SELECT * FROM MY_TABLE SAMPLE SYSTEM (5);

B.

SELECT * FROM MY_TABLE SAMPLE BERNOULLI (5);

Answers
B.

SELECT * FROM MY_TABLE SAMPLE BERNOULLI (5);

C.

SELECT * FROM MY_TABLE SAMPLE (5 ROWS);

Answers
C.

SELECT * FROM MY_TABLE SAMPLE (5 ROWS);

D.

SELECT * FROM MY_TABLE SAMPLE SYSTEM (1) SEED (5);

Answers
D.

SELECT * FROM MY_TABLE SAMPLE SYSTEM (1) SEED (5);

Suggested answer: C

Explanation:

In Snowflake, SAMPLE (5 ROWS) ensures an exact count of 5 rows is returned from MY_TABLE, regardless of table size. This is different from SAMPLE SYSTEM or SAMPLE BERNOULLI, which use percentage-based sampling, potentially returning varying row counts based on probabilistic methods.

The ROWS option is deterministic and does not depend on percentage, making it ideal when an exact row count is required.

asked 12/11/2024
Andrey Scherbakov
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first