Bird
0
0

How can you ensure that only specific users can modify data in a PostgreSQL table while others can only view it?

hard📝 Application Q9 of 15
PostgreSQL - Roles and Security
How can you ensure that only specific users can modify data in a PostgreSQL table while others can only view it?
AGrant ALL permissions to everyone
BGrant UPDATE permission only to specific users and SELECT to others
CRevoke all permissions from everyone
DUse VACUUM to clean the table
Step-by-Step Solution
Solution:
  1. Step 1: Understand permission types

    UPDATE allows modifying data; SELECT allows viewing only.
  2. Step 2: Assign permissions based on user roles

    Grant UPDATE to users who can modify; grant SELECT to others for read-only.
  3. Final Answer:

    Grant UPDATE permission only to specific users and SELECT to others -> Option B
  4. Quick Check:

    Control modify/view by granting UPDATE/SELECT accordingly [OK]
Quick Trick: Assign UPDATE to editors, SELECT to viewers [OK]
Common Mistakes:
  • Giving ALL permissions to all
  • Revoking all permissions unnecessarily
  • Confusing VACUUM with permissions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes