0
0
MySQLquery~10 mins

Role-based access in MySQL - Interactive Code Practice

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

Complete the code to create a new role named 'manager'.

MySQL
CREATE ROLE [1];
Drag options to blanks, or click blank then click option'
Aadmin
Bmanager
Cguest
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using a role name that is not intended, like 'admin' or 'guest'.
Forgetting to use CREATE ROLE before the role name.
2fill in blank
medium

Complete the code to grant SELECT permission on the 'employees' table to the 'manager' role.

MySQL
GRANT [1] ON employees TO manager;
Drag options to blanks, or click blank then click option'
ADELETE
BINSERT
CSELECT
DUPDATE
Attempts:
3 left
💡 Hint
Common Mistakes
Granting INSERT or UPDATE instead of SELECT.
Forgetting to specify the table name.
3fill in blank
hard

Fix the error in the code to assign the 'manager' role to user 'alice'.

MySQL
GRANT [1] TO 'alice'@'localhost';
Drag options to blanks, or click blank then click option'
Amanager
BROLE
CUSER
DROLE manager
Attempts:
3 left
💡 Hint
Common Mistakes
Using the keyword ROLE before the role name.
Using USER instead of the role name.
4fill in blank
hard

Fill both blanks to revoke the UPDATE permission on 'projects' table from the 'developer' role.

MySQL
REVOKE [1] ON projects FROM [2];
Drag options to blanks, or click blank then click option'
AUPDATE
BSELECT
Cdeveloper
Dmanager
Attempts:
3 left
💡 Hint
Common Mistakes
Revoking SELECT instead of UPDATE.
Revoking from the wrong role like 'manager'.
5fill in blank
hard

Fill all three blanks to create a user 'bob', assign the 'analyst' role, and grant SELECT on 'reports' table.

MySQL
CREATE USER '[1]'@'localhost';
GRANT [2] TO '[3]'@'localhost';
GRANT SELECT ON reports TO '[3]'@'localhost';
Drag options to blanks, or click blank then click option'
Abob
Banalyst
Attempts:
3 left
💡 Hint
Common Mistakes
Using different usernames in different lines.
Forgetting to grant the role before table permissions.