Bird
0
0

Which of the following is the correct syntax to grant CREATE privilege on a schema named sales to user alice?

easy📝 Syntax Q12 of 15
PostgreSQL - Roles and Security
Which of the following is the correct syntax to grant CREATE privilege on a schema named sales to user alice?
AGRANT CREATE ON sales TO alice;
BGRANT CREATE TO alice ON SCHEMA sales;
CGRANT CREATE ON SCHEMA sales TO alice;
DGRANT CREATE ON DATABASE sales TO alice;
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct GRANT syntax for schema

    In PostgreSQL, to grant privileges on a schema, the syntax is: GRANT privilege ON SCHEMA schema_name TO user;
  2. Step 2: Match syntax with options

    GRANT CREATE ON SCHEMA sales TO alice; matches this syntax exactly: GRANT CREATE ON SCHEMA sales TO alice;
  3. Final Answer:

    GRANT CREATE ON SCHEMA sales TO alice; -> Option C
  4. Quick Check:

    GRANT ... ON SCHEMA ... TO ... [OK]
Quick Trick: Use 'ON SCHEMA' when granting schema privileges [OK]
Common Mistakes:
  • Omitting 'SCHEMA' keyword
  • Using 'ON DATABASE' instead of 'ON SCHEMA'
  • Placing TO clause incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes