Bird
0
0

You want to allow user carol to read and insert data into the products table but prevent her from deleting or updating any data. Which commands should you use?

hard📝 Application Q15 of 15
PostgreSQL - Roles and Security
You want to allow user carol to read and insert data into the products table but prevent her from deleting or updating any data. Which commands should you use?
AGRANT ALL ON products TO carol; REVOKE DELETE, UPDATE ON products FROM carol;
BGRANT SELECT, INSERT ON products TO carol; REVOKE DELETE, UPDATE ON products FROM carol;
CGRANT SELECT, INSERT, DELETE ON products TO carol;
DGRANT SELECT ON products TO carol; GRANT INSERT ON products TO carol;
Step-by-Step Solution
Solution:
  1. Step 1: Grant only SELECT and INSERT permissions

    To allow reading and inserting, grant SELECT and INSERT on products to carol.
  2. Step 2: Revoke DELETE and UPDATE permissions

    To prevent deleting or updating, explicitly revoke DELETE and UPDATE permissions if previously granted.
  3. Final Answer:

    GRANT SELECT, INSERT ON products TO carol; REVOKE DELETE, UPDATE ON products FROM carol; -> Option B
  4. Quick Check:

    Grant needed permissions, revoke unwanted ones [OK]
Quick Trick: Grant needed permissions, revoke unwanted explicitly [OK]
Common Mistakes:
  • Granting ALL permissions instead of specific ones
  • Not revoking unwanted permissions
  • Granting DELETE or UPDATE by mistake

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes