Database Week 2 Notes
Database Week 2 Notes
Database Relations
Relation schema
Properties of Relations
Relation name is distinct from all other relation names in relational schema. Each cell of relation
contains exactly one atomic (single) value. Each attribute has a distinct name. Values of an
attribute are all from the same domain. Each tuple is distinct; there are no duplicate tuples.
Order of attributes has no significance. Order of tuples has no significance, theoretically.
Relational Keys
Superkey
Candidate Key
Primary Key
Alternate Keys
Foreign Key
Superkey
Candidate Key
Superkey (K) such that no proper subset is a superkey within the relation.
In each tuple of R, values of K uniquely identify that tuple (uniqueness).
Primary Key
Alternate Keys
Foreign Key
Attribute, or set of attributes, within one relation that matches candidate key of some
Views
Base Relation
Named relation corresponding to an entity in conceptual schema, whose tuples are physically stored in
database.
View
Dynamic result of one or more relational operations operating on base relations to produce another
relation.
Purpose of Views
Provides powerful and flexible security mechanism by hiding parts of database from certain users.
Permits users to access data in a customized way, so that same data can be seen by different users in
different ways, at same time.
Updating Views
All updates to a base relation should be immediately reflected in all views that reference that base
relation.
Database planning
System definition
Requirements collection and analysis
Database design
DBMS selection (optional)
Application design
Prototyping (optional)
Implementation
Data conversion and loading
Testing
Operational maintenance
Database Planning
how data will be collected, how the format should be specified, what necessary documentation will be
needed, how design and implementation should proceed.
Database Design
Three phases of database design:
Process of constructing a model of the data used in an enterprise, independent of all physical
considerations. Data model is built using the information in users’ requirements specification.
Conceptual data model is source of information for logical design phase.
Process of constructing a model of the data used in an enterprise based on a specific data model (e.g.
relational), but independent of a particular DBMS and other physical considerations. Conceptual data
model is refined and mapped on to a logical data model.
Physical Database Design