Bird
0
0

You want to allow a group of users to read and modify data in the sales table but prevent them from deleting rows. Which commands should you use?

hard📝 Application Q8 of 15
PostgreSQL - Roles and Security
You want to allow a group of users to read and modify data in the sales table but prevent them from deleting rows. Which commands should you use?
AGRANT SELECT, UPDATE ON sales TO group_users; REVOKE DELETE ON sales FROM group_users;
BGRANT ALL ON sales TO group_users;
CGRANT SELECT, DELETE ON sales TO group_users; REVOKE UPDATE ON sales FROM group_users;
DGRANT SELECT ON sales TO group_users; REVOKE UPDATE, DELETE ON sales FROM group_users;
Step-by-Step Solution
Solution:
  1. Step 1: Identify needed permissions

    Users need SELECT and UPDATE permissions but no DELETE permission.
  2. Step 2: Choose commands that grant SELECT and UPDATE, and revoke DELETE

    GRANT SELECT, UPDATE ON sales TO group_users; REVOKE DELETE ON sales FROM group_users; grants SELECT and UPDATE, then revokes DELETE, matching requirements.
  3. Final Answer:

    GRANT SELECT, UPDATE ON sales TO group_users; REVOKE DELETE ON sales FROM group_users; -> Option A
  4. Quick Check:

    Grant needed permissions, revoke unwanted ones [OK]
Quick Trick: Grant needed permissions, revoke unwanted ones explicitly [OK]
Common Mistakes:
  • Granting ALL permissions including DELETE
  • Revoking permissions not granted
  • Granting DELETE instead of UPDATE

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes