Complete the code to create a row access policy named 'policy1'.
CREATE ROW ACCESS POLICY policy1 AS (user_role STRING) RETURNS BOOLEAN -> user_role = [1];The policy allows access only if the user role is 'ADMIN'.
Complete the code to apply the row access policy 'policy1' to the table 'sales'.
ALTER TABLE sales [1] ROW ACCESS POLICY policy1 ON (user_role);The 'ADD' keyword applies the row access policy to the table.
Fix the error in the row access policy definition to correctly check if the user role is 'ANALYST'.
CREATE ROW ACCESS POLICY policy2 AS (user_role STRING) RETURNS BOOLEAN -> user_role [1] 'ANALYST';
Snowflake uses a single '=' for equality in SQL expressions.
Fill both blanks to create a row access policy that allows access only if the user's department matches the row's department.
CREATE ROW ACCESS POLICY dept_policy AS (user_dept STRING, row_dept STRING) RETURNS BOOLEAN -> user_dept [1] row_dept [2] TRUE;
The policy checks equality and returns TRUE if matched using AND.
Fill all three blanks to create a row access policy that allows access if the user role is 'MANAGER', the region matches, and the access flag is true.
CREATE ROW ACCESS POLICY complex_policy AS (user_role STRING, user_region STRING, row_region STRING, access_flag BOOLEAN) RETURNS BOOLEAN -> (user_role [1] 'MANAGER') [2] (user_region [3] row_region) AND access_flag;
The policy uses OR to check role, AND to combine conditions, and '=' to compare regions.