Sample Exam Questions
Grant a user access to objects, such as SELECT from a table.
Grant a role access to objects, such as SELECT from a table.
Grant a role the permission to create a database (CREATEDB).
Grant all privileges assigned to a role to a user in a batch.
Grant all privileges assigned to a role to another role in a batch.
※This sample exam is different from those that appear in the actual OSS-DB Exam.
2024/05/07
A role (ROLE) is best understood as a collection of privileges that can be executed on a database. While the database allows fine-grained control over access privileges to objects such as tables, instead of granting privileges directly to individual users, you can grant privileges to roles and then grant those roles to users, such as when you want to grant the same privileges to multiple users.
Permissions to access objects are granted with GRANT, specifying the permission type, object name, and user name, as in GRANT SELECT ON table1 TO user1. You can also grant permissions to a role by specifying the role name instead of the user name, for example GRANT SELECT ON table1 TO role1.
To grant a user with privileges granted to a role, use GRANT role1 TO user1. In this case, the role role1 is granted to user1, so if you subsequently grant role1 with additional privileges, user1 is automatically granted with those privileges.
The role can be granted to another role, as in GRANT role TO role2.
In addition to object privileges, databases also grant privileges such as login (LOGIN), user creation (CREATEROLE), and database creation (CREATEDB), which PostgreSQL grants with ALTER ROLE (or ALTER USER) rather than GRANT (Of course, it can also be granted when CREATE ROLE/USER is performed).
This is a question where you need to select the incorrect option, so the correct answer is C.
© EDUCO All Rights Reserved.