Grant column-level access (hard)

Hard
3 views 23 Jan 2026
You want user support_viewer to see only customer_id and name from Customers, not email/phone. Grant SELECT on only these columns (column-level privilege)....

Grant SELECT on a single table

Easy
2 views 23 Jan 2026
Create a user analyst and grant only SELECT on Orders table....

Revoke a privilege

Easy
3 views 23 Jan 2026
User intern was given INSERT on Customers by mistake. Remove it....

Create a role and assign it

Easy
2 views 23 Jan 2026
Create a role report_reader with SELECT on Customers and Orders, then grant the role to user rohit....

Grant execute on a procedure

Easy
2 views 23 Jan 2026
Procedure sp_monthly_sales exists. Give user accountant permission to execute it....

Show current grants (basic)

Easy
2 views 23 Jan 2026
User analyst already exists. Write the SQL to check what privileges/grants are currently given to this user....

Read-only user for a whole schema

Medium
2 views 23 Jan 2026
Create user readonly_user, then give only SELECT access on all tables under schema sales_db. Keep it least-privilege (no insert/update/delete)....

Grant with grant option (careful)

Medium
2 views 23 Jan 2026
Give team_lead SELECT on Employees with grant option, then explain the risk in one line inside description....

Revoke role from a user

Medium
2 views 23 Jan 2026
User rohit should no longer have role report_reader. Write the revoke statement....

Limit DML but allow SELECT

Medium
2 views 23 Jan 2026
User data_entry should be able to SELECT and INSERT into Orders but cannot UPDATE or DELETE. Write grants....

Privilege for view but not base tables

Medium
2 views 23 Jan 2026
Create a view v_public_customers that exposes only customer_id and name. Then grant SELECT on the view to public_user without granting base table access....

Audit-friendly approach for sensitive tables

Hard
2 views 23 Jan 2026
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....

Remove all privileges safely

Hard
3 views 23 Jan 2026
You are deactivating contractor_user. Revoke all granted permissions first, then lock/disable the account (write generic SQL steps)....

Least privilege for stored procedures

Hard
2 views 23 Jan 2026
User app_user should not query base tables directly but can call procedures sp_place_order and sp_pay_order. Write grants only for procedures....

Transfer ownership idea (concept + SQL)

Hard
2 views 23 Jan 2026
If a user owns objects and you want to drop the user, what should you do first? Write a safe sequence in SQL terms....