Data Baselecture 1
Data Baselecture 1
Data Baselecture 1
MANAGEMENT
Lecture 1
HRM 322
By Richard Mkechera
1
INTRODUCTION
What is Database?
Database can be defined as a
collection of information organized in
such a way that it can be accessed
easily.
Examples of database:
i.Telephone directory
ii. Tracking customer orders
iii. Maintain employees records.
2
Database Terminology
Data
This is the fact, or about specific entity(person,place or thing)
Information
Is the data that have been processed and is useful to the user
Field
Is a single item of information or data in entity e.g. employee name
Record
Is a group of fields about an entity,example Employee’s particulars
3
History of databases
Manual system
Before the advent of the ideas behind the modern database systems,it was
common for different firm to store information using manual system.
Structure of manual system
Information concern all division in the firm, can be stored in dedicated room or
each division such as sales, accounts, production can be stored in there own
information separate offices
Room or office will be furnished with shelves,that holds records for different
subjects
Information will be stored in hard flat files, each file will carry one record
Each file will have a specific number to identify it
A person will use a file number to retrieve it
4
5
If management wanted an overall view of the
firm,they would have to gather lots of
information from many different divisions
before the appropriate statistic could be
obtained .
This process was too laborious to be
considered and thus vital information in
decision making could be lost
Due to this problem the modern database
ideas(FPS) were born
6
FILE PROCESSING SYSTEM
8
Limitation of File Processing system
10
DATA BASE MANAGEMENT SYSTEM(DBMS)
12
CHARACTERISTICS OF DBMS
13
EXAMPLES OF DBMS
Ms ACCESS
SQL SERVER
ORACLE
MY SQL
DB2
TERON
POSTGRESS
ENGRESS
14
FUNCTIONS OF DBMS
To store data
To organize data
To control access to data gTo protect data
15
COMPONENTS OF DBMS
16
ADVANTAGES OF DBMS
18
DATABASE ADMINISTRTATOR
19
Data Base Models
20
FLAT DATABASE MODE
22
More efficient than Flat database
Has some serious problems, that you
can not add a record to a child table
until it has already been incorporated
with the parent
Redundancy of data may occur
because it does not handle many to
many relationship
23
24
NETWORK DATABASE MODEL
25
26
RELATIONAL DATABASE MODEL
Is a collection of data items organized as a set of formally-
describes tables from which data can be accessed or
reassembled in many different ways without having to
reorganize the data base tables
A collection of data organized in two-dimensional tables
consisting of named columns and rows
It is easy to create
It is easy to extend, after original database creation.
The core of Relational data base model is the concept of
table, which is also called relation in which all data is store
27
Each table is made up of records (horizontal
rows also known as tuples) and fields (vertical
column also known as attributes)
Table-is a two dimensional representation of data
consisting of column and zero or more rows
The table name must be unique
The table name must be descriptive
28
Null values-is a missing or unknown value in a
column of a table, null are not the same as zeros
Primary key-is the column or group of columns
whose values uniquely identify each row of a table
Every table must have only one PK
Pk must always have a value
PK must be unique
Foreign key is a column or group of columns that
is a primary key in another table
29
30
DATABASE DEVELOPMENT
31
These phases often overlap, and
some techniques and tools may
be used in more than one stage,
especially between analysis and
design. E.g Data Dictionary
32
PLANING PHASE
33
ANALYSIS PHASE
34
Conceptual model
It provide the framework for
developing a database structure
schema from top to down
Three data base components
(entities,attributes and
relationship)
35
Entities
This defines a thing that exist and is
distinguishable from which data will
be collected, e.g person,place or
object.
These are are basic building blocks of
database
36
Entity instance
Is a particular occurrence of an
entity
Entity set/class/type A group of
similar entities
Attributes This describes the
properties of entities and relationship
37
Relationship
A relationship is a connection between entity classes.
Example, relationship between PERSONS and
AUTOMOBILES could be an “OWNS” That is to say ,
people own automobile
Types of relationship
We have three types of relationship
1.One-to-one
2. One-to-may
3.Many-to-many
38
1:1
1:1- Relationship
An entity in A is
associated with
atmost one
entity in B, and
associated with
atmost one
entity in A.
39
1: M
1: M Relationship
(One to Many)
An entity in A is
associated with any
number of entities in
B. An entity in B,
however, can be
associated with at
most one entity in A.
40
M:1
M:1 Relationship
(Many to One) An
entity in A is
associated with at
most one entity in
B.An entity in B,
however, can be
associated with any
number of entities in
A.
41
M:M
M:M
Relationship(M
any to Many)
An entity in A
is associated with
any number of
entities in B, and an
entity in B is
associated with any
number of entities in
A.
42
DESIGN PHASE
Primary Keys:
A primary key is the column or a group of columns that can uniquely identify any
row in the table. This key should also identify the table through the database.
Listed below are some of the important elements of a primary key:
It must uniquely identify each record in a table.
It must contain unique values.
It cannot be a null field.
It cannot be a multi-part field.
It should contain a minimum number of fields necessary to be called
unique.
Its value cannot be modified except in very rare cases .
44
Example
45
Listed below are some rules for establishing primary
keys:
Each table must have only one primary key.
Each table within a database should have a unique
primary key.
When a combination of attributes is used as a
unique identifies, it is known as composite
primary key.
46
Foreign Keys
48
Description of RDBMS parts
PARTS DESCRIPTION
Disk - Meta-data – schema - table definition, view definitions,
Storage: mappings
- Data – relation instances, index structures statistics about data
- Log – record of database update operation sessential for failure
recovery
49
Query Selects a near optimal plan for executing a query- relation
optimizers properties and index structures are utilized
Transaction T
Manager: · Keeps track of start, end of each transaction. Enforces
concurrency control protocols
50
Buffer
Manager
Manages disk space. Implements paging mechanism
Recovery
Manager Takes control as restart after a failure. Brings the system to a
consistent state before it can be resumed
51