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);
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
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
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.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
0e504b5
8 months, 4 weeks ago0e504b5
8 months, 4 weeks agogizzamo
10 months, 2 weeks agoBhargava12
11 months, 3 weeks agoBobFar
1 year agoBobFar
1 year agoHeetec
1 year agoBobFar
1 year agoHeetec
1 year ago