Escolar Documentos
Profissional Documentos
Cultura Documentos
Relational Model
Relational Integrity
Views
1
Relational Integrity
Data models has two parts:
A manipulative part the types of operations
allowed on the data
A set of integrity rules ensure that the data is
accurate
2
Relational Integrity
Integrity rules and constraints:
Domain Constraints
Entity integrity
Referential integrity
Enterprise Constraints
3
Relational Integrity
Every attribute has an associated domain set of values
allowed
Hence there are constraints called as domain constraints
4
Relational Integrity
Null
5
Relational Integrity
Entity Integrity
7
Relational Integrity
Referential Integrity
Referential integrity ensures that the relationship
8
Relational Integrity
Enterprise Constraints
View
Dynamic result of one or more relational operations
operating on the base relations to produce another relation
its a derived relation
10
Views
A view is a virtual relation that does not actually exist
in the database but is produced upon request, at time of
request.
Contents of a view are defined as a query on one or
more base relations. Any operations on the view are
automatically translated into operations on underlying
relations.
Views are dynamic, meaning that changes made to
base relations that affect view attributes are immediately
reflected in the view.
When users make permitted changes to view, changes
11
are made to underlying relations.
Purpose of Views
View mechanism is desirable because:
It provides a powerful and flexible security mechanism
by
hiding parts of the database from certain users. Users are
not aware of the existence of any attributes or tuples
that
are missing from the view.
It permits users to access data in a way that is
customized
to their needs, so the same data can be seen by
different
users in different ways, at the same time
It can simply complex query operations on the base 12
Updating Views
All updates to a base relation should be immediately
reflected in all views that reference that base relation
Similarly, if a view is updated, then the underlying base
relation should reflect the change
However updates through views are:
- Allowed if the view defined using simple query and
derived from a single relation and contains either PK or
Candidate Key
- NOT allowed if the view defined derived from multiple
relations
- NOT allowed if the view defined involves aggregation or
13
grouping operations