0
0
PostgreSQLquery~10 mins

GRANT and REVOKE permissions in PostgreSQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to grant SELECT permission on the table 'employees' to user 'john'.

PostgreSQL
GRANT [1] ON employees TO john;
Drag options to blanks, or click blank then click option'
AUPDATE
BINSERT
CSELECT
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Using INSERT instead of SELECT will not allow reading data.
Forgetting to specify the permission causes syntax errors.
2fill in blank
medium

Complete the code to revoke UPDATE permission on the table 'products' from user 'alice'.

PostgreSQL
REVOKE [1] ON products FROM alice;
Drag options to blanks, or click blank then click option'
AUPDATE
BINSERT
CDELETE
DSELECT
Attempts:
3 left
💡 Hint
Common Mistakes
Revoking SELECT instead of UPDATE does not prevent data changes.
Using incorrect syntax for REVOKE causes errors.
3fill in blank
hard

Fix the error in the code to grant DELETE permission on 'orders' to user 'mike'.

PostgreSQL
GRANT [1] orders TO mike;
Drag options to blanks, or click blank then click option'
ADELETE ON
BDELETE
CON DELETE
DDELETE FROM
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the ON keyword causes syntax errors.
Using DELETE FROM is incorrect in GRANT statements.
4fill in blank
hard

Fill both blanks to grant INSERT and UPDATE permissions on 'customers' to user 'emma'.

PostgreSQL
GRANT [1], [2] ON customers TO emma;
Drag options to blanks, or click blank then click option'
AINSERT
BSELECT
CUPDATE
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Granting SELECT instead of INSERT does not allow adding data.
Forgetting to separate permissions with a comma causes errors.
5fill in blank
hard

Fill all three blanks to revoke SELECT permission on 'sales' from user 'dave' and grant him INSERT permission.

PostgreSQL
REVOKE [1] ON sales FROM dave; GRANT [2] ON sales TO [3];
Drag options to blanks, or click blank then click option'
ASELECT
BINSERT
Cdave
DUPDATE
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of REVOKE and GRANT.
Using wrong user name or permission names.