Challenge - 5 Problems
Table Permissions Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Check SELECT permission effect on query output
Given a table
employees with columns id, name, and salary, user alice has only SELECT permission on this table. What will be the result of the query SELECT * FROM employees; when run by alice?PostgreSQL
SELECT * FROM employees;
Attempts:
2 left
💡 Hint
SELECT permission allows reading all rows and columns unless column-level restrictions exist.
✗ Incorrect
With SELECT permission on the table, the user can read all rows and columns. No error occurs, and no columns are hidden by default.
❓ query_result
intermediate2:00remaining
Effect of missing INSERT permission
User
bob tries to insert a new row into the departments table but does not have INSERT permission on it. What happens when bob runs INSERT INTO departments (id, name) VALUES (5, 'Marketing');?PostgreSQL
INSERT INTO departments (id, name) VALUES (5, 'Marketing');
Attempts:
2 left
💡 Hint
INSERT permission is required to add rows to a table.
✗ Incorrect
Without INSERT permission, the database denies the operation and raises a permission error.
📝 Syntax
advanced2:00remaining
Granting UPDATE permission on a table
Which of the following SQL commands correctly grants UPDATE permission on the
projects table to user carol?Attempts:
2 left
💡 Hint
The correct syntax includes ON TABLE for tables, but ON TABLE is optional in PostgreSQL.
✗ Incorrect
The correct syntax to grant UPDATE permission on a table is GRANT UPDATE ON TABLE table_name TO user;. Option A omits the keyword TABLE, which is optional in PostgreSQL.
🔧 Debug
advanced2:00remaining
Diagnose permission error on DELETE
User
dave tries to delete rows from the tasks table but gets a permission denied error. The DBA confirms that dave has DELETE permission on the table. What could be the reason for the error?Attempts:
2 left
💡 Hint
Some DELETE operations require additional permissions if triggers exist.
✗ Incorrect
If the table has DELETE triggers, the user needs permission to execute those triggers. Lacking TRIGGER permission can cause a permission denied error despite having DELETE permission.
🧠 Conceptual
expert2:00remaining
Understanding role inheritance and table permissions
Role
analyst has SELECT permission on the sales table. Role intern is a member of analyst but has no direct permissions on sales. What permissions does intern have on the sales table?Attempts:
2 left
💡 Hint
Role membership allows permission inheritance unless explicitly revoked.
✗ Incorrect
In PostgreSQL, roles inherit permissions from roles they are members of. Since intern is a member of analyst, it inherits SELECT permission on sales.