Lecture 10: SQL Data Control Language Commands Revision Flashcards

1
Q

What is Data control language command

A

DCL allows users to grant object privileges and system privileges to other database users

object privileges are actions that a user is permitted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

List all object privileges

A
select
insert 
update
delete
references
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why are insert and update special?

A

insert and update privilege can be restricted to specific columns of the table, allowing changes to these columns but disallowing changes to any other columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

DCL consists of two commands

A

GRANT
to grant object privileges to other database users

REVOKE
to revoke previously granted object privileges from database users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

General Syntax of Grant Commadn

A

GRANT {PrivilegeList | ALL PRIVILEGES}

ON ObjectName
TO {AuthorisationIDList | PUBLIC}
[WITH GRANT OPTION]

PrivilegeList: is one or more object privileges separated by commas

All privileges: grant all object privileges to a database user

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an authorisation ID?

A

a valid database user name

e.g. root user in MySQL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is objectName

A

objectName can be a base table or view

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

WITH GRANT OPTION

A

allows privileges to be passed on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

eg of grant all privileges

A

grant all privileges
on staff
to manager with grant option

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

granting specific privileges

A

grant select, update (salary)
on staff
to personnel, director

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

grant specific privileges to public

A

grant select
on branch
to public

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a revoke command

A

revoke takes away privileges granted with GRANT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

syntax for REVOKE

A

revoke [grant option for] {PrivilegeList | ALL Privileges} ON objectName
From {authorisationIDList | Public | Cascade]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How does revoke fail?

A

REVOKE fails if it results in an abandoned object, such as a view, unless the CASCADE keyword has been specified

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

e.g. REVOKE specific privileges from PUBLIC

A

REVOKE SELECT
ON Branch
FROM PUBLIC

REVOKE ALL PRIVILEGES
ON Staff
FROM Director

How well did you know this?
1
Not at all
2
3
4
5
Perfectly