
Answer-first summary for fast verification
Answer: The query will return all columns for records where `age` is 18 or older. Records for users under 18 will be excluded from the results.
Because the analyst is not a member of the "auditing" group, the SQL function `is_member("auditing")` evaluates to `FALSE`. The `CASE` statement in the `WHERE` clause then defaults to the `ELSE` condition: `age >= 18`. This logic acts as a row-level filter. Only rows where the `age` is 18 or older satisfy the predicate and are included in the view's output. The selected columns (`email`, `age`, `lifetimevalue`) are returned with their original values for the surviving rows. - **Option A and E** are incorrect because there is no masking logic (like a `CASE` statement in the `SELECT` clause) to turn values into `NULL`. - **Option C** is incorrect because row-level security is exactly what this `CASE` statement in the `WHERE` clause implements. - **Option D** is incorrect because it uses 'greater than 18' (> 18), whereas the code specifies 'greater than or equal to 18' (>= 18), which includes users who are exactly 18.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A data engineering team manages a Databricks environment where access is controlled via group-based Access Control Lists (ACLs). A table named user_lifetimevalue contains columns email (STRING), age (INT), and lifetimevalue (INT).
A view is defined as follows:
CREATE VIEW userltv_without_minors AS
SELECT email, age, lifetimevalue
FROM user_lifetimevalue
WHERE CASE WHEN is_member("auditing") THEN true ELSE age >= 18 END;
CREATE VIEW userltv_without_minors AS
SELECT email, age, lifetimevalue
FROM user_lifetimevalue
WHERE CASE WHEN is_member("auditing") THEN true ELSE age >= 18 END;
An analyst who is not a member of the "auditing" group executes the following query:
SELECT * FROM userltv_without_minors;
SELECT * FROM userltv_without_minors;
Based on the view definition and the analyst's group membership, which statement best describes the results returned?
A
All age values less than 18 will be returned as NULL, while other columns retain their original values from the underlying table.
B
The query will return all columns for records where age is 18 or older. Records for users under 18 will be excluded from the results.
C
The query will return all records and columns from the underlying table because the is_member function is only used for auditing logs, not row-level security.
D
The query will return all columns for records where age is strictly greater than 18. Records for users aged 18 and younger will be filtered out.
E
All values in the age column will be NULL for every record, while the email and lifetimevalue columns retain their original values.