0% found this document useful (0 votes)
33 views

Chapter2-Part 1

The document defines key concepts in relational database modeling including: - A relation is a table with rows and columns that represents a logical structure of data. - Attributes are the named columns that make up the relations. - Tuples are the individual rows within a relation. - A relational schema defines the relation name and attribute names. - Keys such as primary keys and foreign keys are used to uniquely identify and link tuples between relations. - Integrity constraints like entity integrity ensure consistent data within and across relations.

Uploaded by

flamezodiark
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Chapter2-Part 1

The document defines key concepts in relational database modeling including: - A relation is a table with rows and columns that represents a logical structure of data. - Attributes are the named columns that make up the relations. - Tuples are the individual rows within a relation. - A relational schema defines the relation name and attribute names. - Keys such as primary keys and foreign keys are used to uniquely identify and link tuples between relations. - Integrity constraints like entity integrity ensure consistent data within and across relations.

Uploaded by

flamezodiark
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 21

Relational Data Model

1
Chapter 2 - Objectives
 Terminology of relational model.
 How tables are used to represent data.
 Properties of database relations.
 How to identify PK, AK, and FKs.
 Meaning of entity integrity and
referential integrity.

© Pearson Education Limited 1995, 2005


2
Relational Model
Terminology
 A relation is a table with columns and
rows.
Only applies to logical structure of the
database, not the physical structure.

 Attribute is a named column of a relation.

 Domain is the set of allowable values for


one or more attributes.

© Pearson Education Limited 1995, 2005


3
Relational Model
Terminology
 Tuple is a row of a relation.

 Degree is the number of attributes in a relation.

 Cardinality is the number of tuples in a relation.

 Relational Database is a collection of


normalized relations with distinct relation
names.

© Pearson Education Limited 1995, 2005


4
Instances of Branch and Staff
Relations

© Pearson Education Limited 1995, 2005 5


Examples of Attribute Domains

© Pearson Education Limited 1995, 2005


6
Alternative Terminology for
Relational Model

© Pearson Education Limited 1995, 2005


7
Database Relations
 Relation schema
Named relation defined by a set of attribute
and domain name pairs.

 Relational database schema


Set of relation schemas, each with a
distinct name.

© Pearson Education Limited 1995, 2005


8
Terminology
Table name or relation name Attribute names
Products:
Name Price Category Manufacturer

gizmo $19.99 gadgets GizmoWorks

Power gizmo $29.99 gadgets GizmoWorks

SingleTouch $149.99 photography Canon

MultiTouch $203.99 household Hitachi

Tuples or rows or records 9


Schemas
Relational Schema:
 Relation name plus attribute names
 E.g. Product(Name, Price, Category,
Manufacturer)
 In practice we add the domain for each attribute

Database Schema
 Set of relational schemas
 E.g. Product(Name, Price, Category,
Manufacturer),
Company(Name, Address, Phone),
.......

10
Example
Relational schema:Product(Name, Price, Category, Manufacturer)
Instance:
Name Price Category Manufacturer

gizmo $19.99 gadgets GizmoWorks

Power gizmo $29.99 gadgets GizmoWorks

SingleTouch $149.99 photography Canon

MultiTouch $203.99 household Hitachi


11
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.

© Pearson Education Limited 1995, 2005


12
Properties of Relations
 Each tuple is distinct; there are no
duplicate tuples.

 Order of attributes has no significance.

 Order of tuples has no significance,


theoretically.

© Pearson Education Limited 1995, 2005


13
Relational Keys
 Candidate Key
 A set of one or more attributes(minimal) that can
uniquely indentify a row/tuple in a given table.

 Primary Key
 Candidate key selected to identify row/tuple
uniquely within relation.

 Alternate Keys
 Candidate keys that are not selected to be primary
key.

 Foreign Key
 An attribute (or combination of attributes) in one
table whose values must match the primary key in
© Pearson Education Limited 1995, 2005
another table. 14
Choosing A Primary Key
 Give preference to numeric column(s)
 Give preference to single attribute
 Give preference to minimal composite attribute

© Pearson Education Limited 1995, 2005


15
Choosing Foreign Keys
 A Foreign key is a set of attribute(s) whose
values are required to match values of a column
in the same or another table.

© Pearson Education Limited 1995, 2005


16
Integrity Constraints
 Null
Represents value for an attribute that is
currently unknown or not applicable for
tuple.
Deals with incomplete or exceptional data.
Represents the absence of a value and is
not the same as zero or spaces, which are
values.

© Pearson Education Limited 1995, 2005


17
Integrity Constraints
 Entity Integrity
In a base relation, no attribute of a primary
key can be null.

 Referential Integrity
If foreign key exists in a relation, either
foreign key value must match a candidate
key value of some tuple in its home
relation or foreign key value must be
totally null.

© Pearson Education Limited 1995, 2005


18
Integrity Constraints
 General Constraints
Additional rules specified by users or
database administrators that define or
constrain some aspect of the enterprise.

© Pearson Education Limited 1995, 2005


19
Revision:

- Determine the Relational Data Model characterisics


(relation name, attribute, tuple, degree, cardinality,
primary key, foreign key and relation scheme) in the
given relation.
20
21

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy