Bird
0
0

Identify the error in this SQL snippet:

medium📝 Debug Q14 of 15
PostgreSQL - Roles and Security
Identify the error in this SQL snippet:
CREATE ROLE developers;
CREATE ROLE bob LOGIN;
GRANT developers TO bob NOLOGIN;
ACREATE ROLE bob LOGIN is invalid syntax.
BCREATE ROLE developers must include LOGIN.
CBob cannot be granted a role.
DThe GRANT statement incorrectly uses NOLOGIN.
Step-by-Step Solution
Solution:
  1. Step 1: Review GRANT syntax

    GRANT role TO user does not accept NOLOGIN; NOLOGIN is for CREATE ROLE only.
  2. Step 2: Check other statements

    CREATE ROLE developers is valid as group role; CREATE ROLE bob LOGIN is valid.
  3. Final Answer:

    The GRANT statement incorrectly uses NOLOGIN. -> Option D
  4. Quick Check:

    NOLOGIN only in CREATE ROLE, not GRANT [OK]
Quick Trick: NOLOGIN is for CREATE ROLE, not GRANT [OK]
Common Mistakes:
  • Adding NOLOGIN in GRANT statement
  • Confusing role creation and granting syntax
  • Assuming all roles must have LOGIN

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes