Integrity and Security
Integrity and Security
Domain Constraints
Referential Integrity
Assertions
Triggers
Security
Authorization
Authorization in SQL
Domain Constraints
= t1[K] (r2)
If this set is not empty
either the delete command is rejected as an error, or
the tuples that reference t1 must themselves be deleted
(cascading deletions are possible).
Database Modification (Cont.)
Update. There are two cases:
If a tuple t2 is updated in relation r2 and the update modifies values
for foreign key , then a test similar to the insert case is made:
Let t2’ denote the new value of tuple t2. The system must
ensure that
t2’[] K(r1)
If a tuple t1 is updated in r1, and the update modifies values for the
primary key (K), then a test similar to the delete case is made:
1. The system must compute
= t1[K] (r2)
using the old value of t1 (the value before the update is
applied).
2. If this set is not empty
Alternative to cascading:
on delete set null
on delete set default
Null values in foreign key attributes complicate SQL
referential integrity semantics, and are best
prevented using not null
if any attribute of a foreign key is null, the tuple is
defined to satisfy the foreign key constraint!
Assertions
Physical level
Physical access to computers allows destruction of
data by intruders; traditional lock-and-key security
is needed
Computers must also be protected from floods, fire,
etc.
– More in Chapter 17 (Recovery)
Human level
Users must be screened to ensure that an
authorized users do not give access to intruders
Users should be trained on password selection and
secrecy
Authorization
modification of data.
Insert authorization - allows insertion of new data, but
not modification of existing data.
Update authorization - allows modification, but not
deletion of data.
Delete authorization - allows deletion of data
Authorization (Cont.)
DBA U2 U5
U3
Authorization Grant Graph
intructions.
Network-Level Security