An relational model is based on the mathematical concept of a relation,which is physically represented as a table.
we disscuss the structural part and relational integrity constraints of relation data model.in next chapter , we discuss the relational manipulation
operations.
Attribute is a named column of a relation.
*in the relational model,relations are used to hold information about objects to be represented in the database.A relation is represented as two dimensional table in which the rows of the table correspond to individual records and table columns corresponds to attributes.
Domain: A domain is the set of the allowable values for one or more attributes.
Tuple : A tuple is a row of a relation.
Degree: The degree of a relation is the number of attributes it contains.
Cardinality: A collection of normalized relation with distinct relation names.
Relational database: A collection of normalized relations with distinct relation names.
The Cartesian product of these two sets, writen D1 x D2 , is(=) the set of all ordered pairs such that the first element is a member of D1 and the second element is a member of D2.
Relation schema:A named relation defined by a set of attribute and domain name pairs.Let A1,A2,...,An be attributes with domains D1,D2,...,Dn.Then the set{A1:D1,...,An:Dn} is a relation schema.
Thus , relation R is a set of n-tuples: (A1:d1,...,,An:Dn) such that d1⇚D1,... dn⇚Dn
In this way,we can think of a relation in the relational model as any subset of
the cartesian prodect of the domains of the attributes.
Relational database schema:A set of relation schema,each with a distinct name.
A relation has the following properties:
• the relation has a name that is distinct from all other relation name in the relation schema.
• Each cell of the relation contains exactly one atomic value.
• Each attribute has a distinct name.
• The value of attribute from same domain.
• The order of attribute has no significance• the order of tuples has no significance,theretically
• When we derive the Cartesian product of sets with simple , each element in each tuple was single-value.4.2.5Relational Keys
• In a relation , the possible value for a given position are determine by the set , or domain.
• In a set , no elements are repeated.
• Because a relation is a set,the order of elements has no significance.
We need to be able to identify one or more attributes(called relational key) that uniquely dentifies cach tuple in a relation.
Superkey:An attribute , or set of attributes that uniquely identifies a tuple within a relation.
Candidate key:A superkey such no proper subset is a superkey within the relation.
• uniqueness• irreducibility
Primary key:The candidate key that is select to identify tuples uniquely within the relation.
The candidate key that are not selected to be the primary key are called alternate keys.
Foreign key:An attribute , or set of attribute , within one relation that matches the candidate key of some(possible the same) relation.4.2.6 Representing Relation Database Schema
The common convention for representing a relation schema is to give the name of the relation followed the attribute names in parentless.Normally,theprimary key is underlined.
The conceptual model , or conceptual schema ,is the set of all such schema for the database.
4.3Integrity Constraints
4.3.1Nulls
Null Represents a value for an attribute that is currently unknown or is not applicable for this tuple....as a null is not a value but represents the absence
of a value.
4.3.2 Entity Integrity
Entity integrity:In a base relation,no attribute of a primary key can be null....By definition , a primary key is a minimal identifier that is used to identify
tuple uniquely.This means that no subset of the primary key is sufficient to provide unique identification. If we allow a null for any part of a primary
key,we are implying that not all the attributes are needed to distinguish between tuples,which contradicts the definition of the primary key.
The second integrity rule applies to foreign keys.
Referential integrity:If a foreign key exist 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.
4.3.4General Constraints
General constraints: Additional rules specifies by the users or database administrators of a database the define or constrain some aspect of the
4.4Viewsenterprise.
view is a virtual or derived relatoin:a relation that does not necessarily exist in its own right,but may be dynamically derived from one or more base
relations.
4.4.1Terminology
Base relation:A named relation corresponding to an entity in the conceptual schema,whose tuple are physically stored in the database.
does not necessarily exist in the database but can be produced upon request by a particular user,at the time of the request.