Database praktikum pertemuan 9


Sintaks (Syntax)

Grant
GRANT { ALL [ PRIVILEGES ] }
| permission [ ( column [ ,…n ] ) ] [ ,…n ]
[ ON [ class :: ] securable ] TO principal [ ,…n ]
[ WITH GRANT OPTION ] [ AS principal ]

Revoke
REVOKE [ GRANT OPTION FOR ]
{
[ ALL [ PRIVILEGES ] ]
|
permission [ ( column [ ,…n ] ) ] [ ,…n ]
}
[ ON [ class :: ] securable ]
{ TO | FROM } principal [ ,…n ]
[ CASCADE] [ AS principal ]

Create User
CREATE USER user_name
[
{ FOR | FROM } LOGIN login_name
]
[ WITH DEFAULT_SCHEMA = schema_name ]
[ ; ]

Drop User
DROP USER user_name

Tabel Relasional
Tabel Relasional


/1.Buatlah sebuah login dengan nama ‘ManagerUser’ yang memiliki password ‘manager’.(create login)/

create login ManagerUser
with password =’manager’

/2.Buatlah sebuah database user dengan nama ‘Manager’ untuk login ‘ManagerUser’.(create user)/

create user Manager
for login managerUser

/3.Buatlah sebuah login dengan nama ‘EmployeeUser’ yang memiliki password ‘employee’(create login)/

create login EmployeeUser
with password =’employee’

/4.Buatlah sebuah database user dengan nama ‘Employee untuk login ‘EmployeeUser’.(create user)/

create user Employee
for login EmployeeUser

/5.Berilah hak akses kepada publik (select, insert, update, delete, dll) terhadap tabel MsTreatment.(grant all)/

grant select, insert, update, delete, alter
on mstreatment to public

/6.Berilah hak akses kepada ‘Manager’ untuk melakukan insert, update dan delete terhadap tabel MsStaff dan ‘Manager’ juga dapat memberikan hak akses pada tabel MsStaff kepada user lainnya.(grant)/

grant insert, update, delete on MsStaff to Manager
with grant option

/7.Berilah hak akses kepada ‘Manager’ untuk melakukan select terhadap tabel MsTreatment. (grant)/ 

grant select
on MsTreatment to Manager

/8.Berilah hak akses kepada ‘Employee’ dengan menggunakan user ‘Manager’ untuk melakukan select terhadap tabel MsTreatment.(grant)/

grant select
on MsTreatment to Employee

/9.Cabutlah semua hak akses tabel MsTreatment dari publik.(revoke)/

revoke select, insert, update, delete, alter
on MsTreatment from public

/10.Cabutlah hak akses untuk select pada tabel MsTreatment dari ’Manager’.(revoke)/

revoke delete
on msStaff from manager cascade

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s