Read-only user for a whole schema
SQL
Medium
3 views
Problem Description
Create user readonly_user, then give only SELECT access on all tables under schema sales_db. Keep it least-privilege (no insert/update/delete).
Input Format
SQL statements
Output Format
Privileges applied
Sample Test Case
Input:
Schema sales_db exists
Constraints
Syntax varies by database
Official Solution
CREATE USER readonly_user IDENTIFIED BY 'StrongPass123'; GRANT SELECT ON ALL TABLES IN SCHEMA sales_db TO readonly_user;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!