PostgreSQL User and Role Management Queries
This resource offers a total of 50 PostgreSQL Creating and managing roles and users problems for practice. It includes 10 main exercises, each accompanied by solutions, detailed explanations, and four related problems.
Following exercises cover to Creating and managing roles and users PostgreSQL performance.
1. Create a New Role
Write a PostgreSQL query to create a new role named data_analyst with login privileges.
2. Create a User with a Password
Write a PostgreSQL query to create a new user named app_user with a password.
3. Grant SELECT Privileges to a User
Write a PostgreSQL query to grant SELECT privileges on the employees table to the user data_analyst.
4. Revoke a User’s Privileges
Write a PostgreSQL query to revoke INSERT privileges on the orders table from the user sales_rep.
5. Change a User’s Password
Write a PostgreSQL query to update the password for the user app_user to a new value.
6. Assign a User to a Role
Write a PostgreSQL query to grant the role data_admin to the user alen_king.
7. List All Users and Roles
Write a PostgreSQL query to list all users and roles in the database.
8. Remove a User
Write a PostgreSQL query to delete the user temp_user.
9. Lock a User Account
Write a PostgreSQL query to disable the login capability for inactive_user.
10. Create a Role with Limited Connection Attempts
Write a PostgreSQL query to create a role limited_user with a maximum of 3 connections.
More to Come !
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.