
Answer-first summary for fast verification
Answer: It will return a random 100 rows.
**Correct Answer: B — It will return a random 100 rows.** ### Explanation The `TABLESAMPLE` clause in Snowflake allows you to retrieve a **random subset** of rows from a table. When you use: ```sql TABLESAMPLE (100 ROWS) ``` Snowflake interprets this as **sampling by a fixed number of rows**, not by percentage. It attempts to randomly return **up to 100 rows** from the `gold_data` table. If the table has fewer than 100 rows, it will return all available rows. This is different from probability-based sampling, such as `TABLESAMPLE (10)`, which selects rows based on a percentage chance. ### Why the other options are incorrect: - **A:** An empty sample would only occur if `0 ROWS` were specified. - **C:** Sampling does not return the entire table unless the table has ≤100 rows. - **D:** The syntax is valid, so no error is produced. Reference: https://docs.snowflake.com/en/sql-reference/constructs/sample
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
What will be the output of the following query executed on the table named gold_data?
SELECT * FROM gold_data TABLESAMPLE (100 ROWS);
SELECT * FROM gold_data TABLESAMPLE (100 ROWS);
A
It will return an empty sample.
B
It will return a random 100 rows.
C
It will return an entire table.
D
It will produce an error message.
