6

This is more of a theoritical question but I need help ASAP. Here it is:

With the appropriate use of SQL queries, grant as system administrators the required access privileges to a database user named STD01, so he can create a view of a table named CUSTOMER, which belongs to another database user STD00.

Can anyone help me with this?

I know that I have to grant him with the system privilege of CREATE (ANY) VIEW and also give him all the object privileges (SELECT, INSERT, UPDATE & DELETE) on the CUSTOMER table, but I have no idea how can I do that by using SQL...

2
  • 2
    Is this some kind of homework?
    – Philᵀᴹ
    Feb 1, 2012 at 18:19
  • Its a kind of a possible question for an exam I'm having tomorrow, can you help?
    – lephleg
    Feb 1, 2012 at 18:42

1 Answer 1

10

To grant privilege to create a view:

GRANT CREATE VIEW TO STD01;

To grant the DML privileges:

GRANT SELECT,UPDATE,INSERT,DELETE ON STD00.CUSTOMER TO STD01;

But that's not all of the object privileges. If you did:

GRANT ALL ON STD00.CUSTOMER TO STD01;

you would also give other privileges such as ALTER, INDEX, FLASHBACK, etc.

3
  • If I grant him only the SELECT privilege, would it still work?
    – lephleg
    Feb 2, 2012 at 0:03
  • 2
    If you just grant select and create view then, yes, it will allow you to create a view on the customer table.
    – John Doyle
    Feb 2, 2012 at 0:11
  • I've just tested this and worked fine, so thats why Im asking. But I guess I'll better write the whole command tomorrow as you did above. You just never know with professors.. Thanks for the help!:)
    – lephleg
    Feb 2, 2012 at 0:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.