Domains, Relations, and Base Relvars - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Domains, Relations, and Base Relvars

Description:

Domains, Relations, and Base Relvars. Introduction. Structural Terminology. Pool of legal values ... S#: the set of all possible supplier numbers. Operators ... – PowerPoint PPT presentation

Number of Views:200
Avg rating:3.0/5.0
Slides: 13
Provided by: kowonDo
Category:

less

Transcript and Presenter's Notes

Title: Domains, Relations, and Base Relvars


1
Domains, Relations, and Base Relvars
2
Introduction
  • Structural Terminology

3
Structural Terminology
4
Domains
  • A domain is a data type
  • Ex) system-defined type INTEGER, CHAR
  • User-defined type S, P,
  • A Type
  • All possible values of the type
  • Ex) the type INTEGER the set of all possible
    integers
  • S the set of all possible supplier
    numbers

5
Operators
  • For each type defined, there are valid operators
    that can be legally applied to the values of the
    type
  • Ex) integer
  • Comparison operators like , lt,
  • Arithmetic operators like , ,
  • Ex) S
  • Only Comparison operators like , lt,

6
Type and Physical Representation
  • Types
  • A model issue
  • ? the operators for a given type will depend on
    the intended meaning or semantics of the type
  • Physical representation
  • An implementation issue
  • Ex) S
  • Physically represented as a character string
  • But no character string operation

7
Role of Types
  • For every operation, there will be type checking
  • Assures legal operations only
  • Ex) P.WEIGHT SP.QTY
  • Meaningless ? rejected
  • Ex) P.WEIGHT SP.QTY
  • Meaningful ? accepted

8
Values are typed
  • A value carries a type
  • a kind of flag like
  • I am an integer or I am a supplier number
  • Possible operations between values are checked
    for every operation

9
Type definition
  • Tutorial D
  • A hypothetical Pascal-like language to explain
    concepts in the textbook
  • Format of type definition
  • TYPE lttype namegt ltpossible representationgt
  • Ex) the type definitions for the suppliers and
    parts database
  • TYPE S POSSREP (CHAR)
  • TYPE NAME POSSREP (CHAR)
  • TYPE P POSSREP (CHAR)
  • TYPE COLOR POSSREP (CHAR)
  • TYPE WEIGHT POSSREP (RATIONAL)
  • TYPE QTY POSSREP (INTEGER)

10
Relation values
  • relation for short
  • Definition of relation
  • Given a collection of n types or domains Ti
    (i1,2,,n), not necessarily all distinct, r is a
    relation on those types if it consists of 2
    parts, a heading and a body, where (see the next
    slide)

11
Relation values (cont.)
  • Definition of relation (cont.)
  • The heading is a set of n attributes of the form
    AiTi, where Ai is attribute name and Ti is type
    name (i1, 2, , n)
  • The body is a set of m tuples t, where t is a set
    of components of the form Aivi in which vi is a
    value of type Ti (i1, 2, , n)
  • m cardinality, n degree

12
Properties of Relations
  • There are no duplicate tuples
  • Tuples are unordered, top to bottom
  • Attributes are unordered, left to right
  • Each tuple contains exactly one value for each
    attribute ? first normal form(1NF)
Write a Comment
User Comments (0)
About PowerShow.com