Sunteți pe pagina 1din 31

Chapter 1 Introduction to RDBMS

D ATA B A S E M A N A G EM EN T
S Y S TEM

O bjectives
Discuss the theoretical and physical

aspects of a relational database


Discuss the relational database
concept
Create an entity relationship diagram
from business specifications or
narratives

D ata Storage on D iff


erent
M edia
Hard disk
CDs
Index Cards
Notebook
Paper
Etc

D atabase
Organized collection of data
DBMS (Database Management

System)
A DBMS is a program that stores,

retrieves, and modifies data in the


database on request
Examples:
Oracle
MySQL
SQLserver
Ms Access

RelationalD atabase Concept


Dr. E. F. Codd proposed the relational

model for database systems in 1970.


It is the bases for the relational
database management system
(RDBMS).
The relational model consists of the
following:
Collection of objects or relations
Set of operators to act on the relations
Data integrity for accuracy and

RelationalD atabase
A relational database is a collection

of relations of two-dimensional tables

Entity-Relationship D iagram
An entity relationship (ER) model is

an illustration of various entities in a


business and the relationships
between them.
An ER model is derived from
business specifications or narratives
and built during the analysis phase
of the system development cycle.

Exam ple ofER D iagram

Benefi
ts ofER D iagram
Documents information for the

organization in a clear, precise


format
Provides a clear picture of the scope
of the information requirement
Provides an easily understood
pictorial map for the database
design.
Offers an effective framework for
integrating multiple applications

Key Com ponents ofER


D iagram
Entity: A thing of significance about which

information needs to be known. Examples are


department, employees, students, advisement slips,
and orders.
Attribute: Something that describes or qualifies
an entity. For example, for the employee entity, the
attributes would be the employee number, name,
job title, hire date, department number and so on.
Each of the attribute is either required or optional.
This state is called optionality.
Relationship: A named association between
entities showing optionality and degree. Examples
are employee and department, orders and items.

D ata Relationships
A relationship is a logical link

between entities based on how they


interact

Entity-relationship diagrams

(ERDs)

An ERD is a graphical model that shows

relationships among system entities

Entity-relationship diagram s
(ERD s)
Each entity is a

rectangle,
labeled with a
noun

Each

relationship is a
diamond,
labeled with a
verb

Types ofrelationships
1. One-to-one (1:1)
2. One-to-many (1:M)
3. Many-to-many (M:N)

O ne-to-one (1:1) relationship


Exists when exactly one of the second entity occurs for
each instance of the first entity

O ne-to-m any (1:M )


relati
onshi
p
Exists when one occurrence of the first entity can be
related to many occurrences of the second entity, but
each occurrence of the second entity can be associated
with only one occurrence of the first entity

M any-to-m any (M :N )
rel
atiwhen
onshi
p of the first entity can be related
Exists
one instance
to many instances of the second entity, and one instance
of the second entity can be related to many instances of
the first

A complete ERD shows all system

relationships
Examples
A sales rep serves one or more customers, but each
customer has only one sales rep
A customer places one or more orders, but each order
has only one customer
An order lists one or more products, and each product
can be listed in one or more orders
A warehouse stores one or more products, and each
product can be stored in one or more warehouses

Cardinality
Describes how

instances of one
entity relate to
another
Crows foot

notation is one
method of
showing
cardinality

Creating an ERD
1. Identify the entities
2. Determine all significant events or
activities for two or more entities
3. Analyze the nature of the
interaction
4. Draw the ERD

D ata D esign Term inology


Definitions
Entity: a person, place, thing, or event

for which data is collected and


maintained
Field (attribute): a single

characteristic or fact about an entity


Record: a collection of fields that

describes one instance of an entity


File and table: a set of records that

contains data about a specific entity

Key fi
elds
Used to organize, access, and maintain

data structures
Four types of keys
Primary keys
Candidate keys
Foreign keys
Secondary keys

Prim ary keys


A field or combination of fields that
uniquely and minimally identifies each
member of an entity
A primary key composed of more than
one field is called a multivalued key

Candidate keys
Any field that could serve as primary key
Any field that is not a primary key or
candidate key is called a nonkey field

Foreign keys
A field in one file that matches a primary
key value in another file
A foreign key need not be unique

Secondary keys
A field or combination of fields that can
be used to access or retrieve records
Secondary keys do not need to be unique

1. A single row or tuple representing all data required for a particular

student. Each row should be identified by a primary key, which allows


no duplicate rows.
2. A column or attribute containing the student number, which is also
the primary key. The student number identifies a unique student in
the STUD table. A primary key must contain a value.
3. A column that is not a key value. A column represents one kind of
data in a table; in the example, the address of all students
4. A column containing the College No. which is also a foreign key. A
foreign key is a column that defines how tables relate to each other.
A foreign key refers to a primary key or a unique key in another table.
In the example, CollegeNo uniquely identifies a college in the
COLLEGE table.
5. A field can be found at the intersection of a row and a column.
There can be only one value in it.
6. A field may have no value in it. This is called a null value. In the
STUD table, some students have no Phone numbers

S-ar putea să vă placă și