Exam SnowPro Core All QuestionsBrowse all questions from this exam
Question 905

How can a Snowflake user sample 10 rows from a table named SNOWPRO? (Choose two.)

    Correct Answer: B, E

    In Snowflake, if you want to sample a specific number of rows from a table, you can use the TABLESAMPLE clause. Specifically, 'SELECT * FROM SNOWPRO TABLESAMPLE (10 ROWS)' will correctly sample 10 rows from the table. Another valid method is using the SAMPLE clause with the BERNOULLI technique, which supports fixed-size row sampling. Therefore, 'SELECT * FROM SNOWPRO SAMPLE BERNOULLI (10 ROWS)' is also correct. The SYSTEM and BLOCK methods are not applicable here as they do not support fixed-size row sampling.

Discussion
BobFarOptions: BE

BE is the correct answer. System or Block do not support fixed rows. https://docs.snowflake.com/en/sql-reference/constructs/sample#:~:text=BERNOULLI%20%7C%20ROW%20or%20SYSTEM%20%7C%20BLOCK

BobFar

I checked 1- " SELECT * FROM SNOWPRO TABLESAMPLE BLOCK (10 ROWS)" 2- " SELECT * FROM SNOWPRO TABLESAMPLE SYSTEM (10 ROWS)" and got below error! Sampling with a fixed size does not support using block sampling method. BE is correct.

gizzamoOptions: BE

B and E are correct. https://docs.snowflake.com/en/sql-reference/constructs/sample#fixed-size-row-sampling

Bhargava12Options: BE

SELECT * FROM SNOWPRO TABLESAMPLE (10 ROWS) SELECT * FROM SNOWPRO SAMPLE BERNOULLI (10 ROWS) BE give 10 rows

0e504b5Options: BE

SELECT COUNT(*) FROM SNOWFLAKE_SAMPLE_DATA.TPCDS_SF100TCL.CALL_CENTER; --60 -- A - not correct -- showing different results each time -- 5, 8, 7 SELECT COUNT(*) FROM SNOWFLAKE_SAMPLE_DATA.TPCDS_SF100TCL.CALL_CENTER TABLESAMPLE SYSTEM (10); -- B - correct --10 SELECT COUNT(*) FROM SNOWFLAKE_SAMPLE_DATA.TPCDS_SF100TCL.CALL_CENTER TABLESAMPLE (10 ROWS); -- C - not correct --9,6,11 SELECT COUNT(*) FROM SNOWFLAKE_SAMPLE_DATA.TPCDS_SF100TCL.CALL_CENTER TABLESAMPLE BLOCK (10); -- D - not working --Sampling with a fixed size does not support using block sampling method. SELECT COUNT(*) FROM SNOWFLAKE_SAMPLE_DATA.TPCDS_SF100TCL.CALL_CENTER TABLESAMPLE BLOCK (10 ROWS); -- E - correct -- 10 SELECT COUNT(*) FROM SNOWFLAKE_SAMPLE_DATA.TPCDS_SF100TCL.CALL_CENTER TABLESAMPLE BERNOULLI (10 ROWS);

0e504b5

BERNOULLI | ROW or SYSTEM | BLOCK Specifies the sampling method to use: BERNOULLI (or ROW): Includes each row with a probability of p/100. Similar to flipping a weighted coin for each row. SYSTEM (or BLOCK): Includes each block of rows with a probability of p/100. Similar to flipping a weighted coin for each block of rows. This method does not support fixed-size sampling. https://docs.snowflake.com/en/sql-reference/constructs/sample

HeetecOptions: BD

BD correct

BobFar

System or Block do not support fixed rows.

Heetec

thanks for correction :)