Database Quiz 2
Purpose of views
- 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 that the same data can be seen by different users in different ways, at the same time. - It can simplify complex operations on the base relations. For example, if a view is defined as a combination (join) of two relations, users may now perform more simple operations on the view, which will be translated by the DBMS into equivalent operations on the join.
relational model's objectives
- To allow a high degree of data independence. Application programs must not be affected by modifications to the internal data representation, particularly by changes to file organizations, record orderings, or access paths. - To provide substantial grounds for dealing with data semantics, consistency, and redundancy problems. In particular, Codd's paper introduced the concept of normalized relations, that is, relations that have no repeating groups. - To enable the expansion of set-oriented data manipulation languages.
Properties of relations
- the relation has a name that is distinct from all other relation names in the rela- tional schema; - each cell of the relation contains exactly one atomic (single) value; - each attribute has a distinct name; - the values of an attribute are all from the same domain; - each tuple is distinct; there are no duplicate tuples; - the order of attributes has no significance; - the order of tuples has no significance, theoretically.
Relational database
A collection of normalized relations with distinct relation names.
Domain
A domain is the set of allowable values for one or more attributes.
Composite key
A key with more than one attribute.
Base relation
A named relation corresponding to an entity in the conceptual schema, whose tuples are physically stored in the database.
Relation schema
A named relation defined by a set of attribute and domain name pairs.
Relation
A relation is a table with columns and rows.
Relational database schema
A set of relation schemas, each with a distinct name.
Candidate key
A superkey such that no proper subset is a superkey within the relation.
Tuple
A tuple is a row of a relation.
General constraints
Additional rules specified by the users or database administrators of a database that define or constrain some aspect of the enterprise.
Attribute
An attribute is a named column of a relation.
Superkey
An attribute, or set of attributes, that uniquely identifies a tuple within a relation.
Foreign key
An attribute, or set of attributes, within one relation that matches the candidate key of some (possibly the same) relation.
Referential integrity
If a foreign key exists in a relation, either the foreign key value must match a candidate key value of some tuple in its home relation or the foreign key value must be wholly null.
Entity integrity
In a base relation, no attribute of a primary key can be null.
Convention for representing relation
Relation (underlinedKey, attributes)
Null
Represents a value for an attribute that is currently unknown or is not applicable for this tuple.
Primary key
The candidate key that is selected to identify tuples uniquely within the relation.
Cardinality
The cardinality of a relation is the number of tuples it contains.
Degree
The degree of a relation is the number of attributes it contains.
View
The dynamic result of one or more relational operations operating on the base relations to produce another relation. A view is a virtual relation that does not necessarily exist in the database but can be produced upon request by a particular user, at the time of request.
Extension/State
The tuples are of a relation
Properties of candidate keys
uniqueness and irreducibility.