Complete the code to select a random 10% sample of rows from the table named employees.
SELECT * FROM employees TABLESAMPLE [1] (10);
The SYSTEM method is a common TABLESAMPLE method in PostgreSQL to get a random sample of rows.
Complete the code to select a 5% random sample of rows using the BERNOULLI method.
SELECT * FROM sales TABLESAMPLE [1] (5);
The BERNOULLI method samples rows individually with the given percentage.
Fix the error in the code to correctly sample 20% of rows from the products table.
SELECT * FROM products TABLESAMPLE [1] (20);
The sampling percentage must be inside parentheses. The correct syntax is TABLESAMPLE SYSTEM (20).
Fill both blanks to select a 15% random sample of rows from the orders table using the BERNOULLI method.
SELECT * FROM orders TABLESAMPLE [1] ([2]);
The BERNOULLI method samples rows with the given percentage, which is 15% here.
Fill all three blanks to select a 25% random sample of rows from the customers table using the SYSTEM method.
SELECT * FROM customers TABLESAMPLE [1] ([2]) REPEATABLE ([3]);
The SYSTEM method samples pages randomly. The percentage is 25, and REPEATABLE uses a seed value like 12345 for repeatable results.