sql / intermediate
Snippet
Fine-Grained Column Access Control using Explicit Privileges
Column-level GRANT permissions enable security administrators to grant access strictly to non-sensitive columns within a table. This enforces the Principle of Least Privilege by withholding confidential fields such as salary or personal identifier numbers.
snippet.sql
sql
1
2
GRANT SELECT (employee_id, department_id, job_title) ON TABLE employees TO hr_assistant;GRANT UPDATE (job_title) ON TABLE employees TO hr_assistant;
Breakdown
1
GRANT SELECT (employee_id, department_id, job_title) ON TABLE employees TO hr_assistant;
Grants read permission exclusively for non-sensitive employee attributes to the hr_assistant role.
2
GRANT UPDATE (job_title) ON TABLE employees TO hr_assistant;
Restricts modification permissions strictly to the job title column for the specified user role.