I want to grant a user only to edit one column in my table. What command do I use here? I use the oracle 11g database. I alrdy know how I can grant only read or delete on the whole table but how do I do it for only one column or more? pls give an example.
Generate the GRANT statements for column level permissions using the following query: SELECTCONCAT('GRANT SELECT (`', COLUMN_NAME, '`), SHOW VIEW ON mydatabase. `', TABLE_NAME, '` to ''myuser''@`myhost`;') FROM INFORMATION_SCHEMA. COLUMNS WHERE TABLE_SCHEMA = 'mydatabase' AND TABLE_NAME = 'mytable';
You can also grant one or more table privileges by specifying a privilege-list. Use the DELETE privilege type to grant permission to delete rows from the specified table. Use the INSERT privilege type to grant permission to insert rows into the specified table.
grantable. Indicates YES if the grantee can pass along the privilege and NO if the grantee cannot pass along the column-level object privilege.
To GRANT ALL privileges to a user , allowing that user full control over a specific database , use the following syntax: mysql> GRANT ALL PRIVILEGES ON database_name. * TO 'username'@'localhost';
For example, you want to grant update privilege on ename column only, then give the following statement (where xyz is the username)
grant update (ename) on emp to xyz;
Syntax:
grant update(column-name) on table-name to user-name
EDIT: (for granting select privilege)
To grant select statement on emp table to XYZ and to make XYZ be able to further pass on this privilege you have to give WITH GRANT OPTION clause in GRANT statement like this.
grant select on emp to xyz with grant option;
Also, For example you want to grant update privilege on ename column only and insert privilege on empno and ename columns only, you can do this:
grant update (ename),insert (empno, ename) on emp to xyz;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With