Unit 4 Data Models
Unit 4 Data Models
Unit 4 Data Models
Note:
Some slides and/or pictures are adapted from Lecture slides /
Books of
• Peter Rob
• Jeffery. A. Hoffer
• Thomas M. Connolly
• Ramez Elmasri
• Silberschtaz
Row
entity
15
Definition Summary
6. Surrogate Key
• Sometimes row-ids or sequential numbers are assigned to
uniquely identify each tuple of the relation. Such key is
called artificial key or surrogate key.
7. Secondary Key, Sort Key is a key used in data retrieval
For Ex: List all students of BS program.
some value.
Example: if student tuple must have a valid, non-Null value
© 2009 Punjab University College of Information Technology (PUCIT) September 8, 2009 Slide 27
Integrity Constraints or Integrity Rules
3. Referential Integrity:
• It is a constraint involving two relations called referencing relation and
referenced or target relation.
• It specifies a relationship among tuples in two relations.
• A tuple t1 in R1 (referencing relation) is said to reference a tuple t2 in
R2 (referenced relation) if t1[FK] = t2[PK].
• The database must not contain any unmatched FK values.
• The value in the foreign key column (or columns) FK of the referencing
relation R1 can be either:
1. A value of an existing primary key value of a corresponding
primary key PK in the referenced relation R2, or
2. a null.
• In case (2), the FK in R1 should not be a part of PK of its containing
relation.
CUSTOMER
ORDER
ORDER_LINE
PRODUCT
4. Action Assertion
• Control on the actions of the organization
• “An Employee can avail a certain facility only after a
certain period of service.
Assistant Professor
University of the Punjab
Punjab University College of Information Technology (PUCIT)
Allama Iqbal (Old) Campus, Anarkali
Lahore, Pakistan
Tel: +92-(0)42-111-923-923 Ext. 154
E-mail: [email protected]