Audit-friendly approach for sensitive tables
SQL
Hard
2 views
Problem Description
You want to allow SELECT on Payroll only through a view, not directly on the base table. Create a view that hides salary and bank_account, then grant SELECT on the view to user auditor.
Input Format
SQL DDL + DCL
Output Format
View created + privileges
Sample Test Case
Input:
Payroll(emp_id, salary, bank_account)
Output:
Masked data accessible
Constraints
Do not grant base table
Official Solution
CREATE VIEW v_payroll_masked AS SELECT emp_id, NULL AS salary, NULL AS bank_account FROM Payroll; GRANT SELECT ON v_payroll_masked TO auditor;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!