Вы находитесь на странице: 1из 37

LECTURE 1:

INTRODUCTION TO DATABASES

Database Prehistory

Data entry

Query processing

Storage and retrieval

Sorting

Early Automation

Data management and application code


were all tangled together
Hard to modify
Hard to generalize

Many competing approaches


Data manipulation code written at very
low levels of abstraction

Our Hero --- E. F. Codd


Edgar F. "Ted" Codd ( August 23, 1923 - April 18, 2003) was a British computer scientist
who invented relational databases while working for IBM.
He was born in Portland, Dorset, studied maths
and chemistry at Oxford. He was a pilot in the
Royal Air Force during WWII. In 1948 he joined IBM
in New York as a mathematical programmer. He fled
the USA to Canada during the McCarthy period.
Later, he returned to the USA to earn a doctorate in CS
from the University of Michigan in Ann Arbor. He then
joined IBM research in San Jose.
His 1970 paper A Relational Model of Data for
Large Shared Data Banks changed everything.
In the mid 1990s he coined the term OLAP.
4

Database Management
Systems (DBMSs)
Your Applications
Go Here

DBMS

Database abstractions
allow this interface to
be cleanly defined and
this allows applications
and data management
systems to be
implemented
separately.

Raw Resources (bare metal)


5

Today, Database Systems are Ubiquitous


Database system design from the European Bioinformatics Institute (Hinxton UK)

ha
n

Service Tools

ex
c

Submission tools

Submitters

Da
ta

Database
design
Development
DB

ge

Q/C etc

Production DB

End Users

Other archives

Service DB

D
at
aD
ist
Add value
rib
.
(computation)

Add value (review etc.)

Releases
Releases
&
&
Updates
Updates
6

What is a database
system?

A database is a large, integrated


collection of data
A database contains a model of
something!
A database management system
(DBMS) is a software system designed
to store, manage and facilitate access to
the database

What does a database system


do?

Manages Very Large Amounts of Data


Supports efficient access to Very Large
Amounts of Data
Supports concurrent access to Very
Large Amounts of Data
Supports secure, atomic access to
Very Large Amounts of Data

Database system
architecture

It is common to describe databases in two ways


The logical level:
What users see, the program or query language
interface,
The physical level:
How files are organised, what indexing mechanisms are

used,

It is traditional to split the logical level into two:


overall database design (conceptual) and the
views that various users get to see
A schema is a description of a database

Three-level architecture
External
Schema 1
Conceptual
level
Physical
level

External
Schema 2
Conceptual
Schema

External
Schema n
External
level

Internal
Schema

10

Data Abstraction

Data abstraction is a level of data inside


database system.
There are 3 level of data abstraction:
Physical Level Internal Level
Conceptual Level
View Level External Level

11

Physical Level (Internal


Level)

Physical level is a lower level which


describe how an actual data stored

At this level, representation of data


organization stored as text, number, or set
of data bits. Knowing that the data is stored
in multiple files / tables, such as clerks file,
family files, etc.

12

Conceptual Level
(Logical)

Focus on what the data actually


(functionally) stored in the database and its
relationship with other data.
These levels describe what data is stored in
the database and the relationships that
occur between the data of the entire
database. Users do not care about the
physical level of complexity in the structure
again, portrayal enough using boxes, lines,
and connections sufficiently.
13

View Level (External)

The highest level of data abstraction that


only shows data partially from the entire
database, in accordance with the needs of
users.
For users who use to feel as a unit of data
that is compact.

14

Level of Data

15

Characters : is the smallest part of the


data, can be either numeric characters,
letters or special characters that form a
data item / field.

Field : represents an attribute of a record


that indicates an item of the data, such as
name, address and so forth. A collection
of fields forms a record.

16

Record : A collection of fields forms a


record. Record describing a particular
individual data unit. A collection of records
form a file. Eg personnel files, each record
can represent the data for each employee.

File: The file consists of records that


describe the unity of similar data. For
example, subject files containing data
about all the subjects that exist.

17

Database : A collection of files / tables


form a database

18

Data Model

Definition:
a set of conceptual tools for describing data,
relationships between data that represent
relationships between records stored in the
database.
Model Entity-Relationship
Model Relational
Model Object Oriented Model
Model Hierarchy
Model Network

20

ENTITY RELATIONAL MODEL

E-R model based on the perception of the real world


that consists of a set of objects, called entities and
relationships between these objects, called a
relationship.
ER Diagram consist of:
Rectangular box, describe the set of entities
Ellipse, describe the attributes of the entity
Diamond, describes the relationship between the
entity set.
Line, connecting between objects in the diagram E-R

21

HOBY

ORANG TUA
1

n
senangi

punya
1

MAHASISWA

ambil

daftar
1
JURUSAN

MATAKULIAH

ajar
1

miliki

m RUANG

1
DOSEN

22

Object Oriented Model


Object-oriented model based on the collection of objects.
Each object contains :
The value stored in the instance variable, where variable
"attached" to the object itself.
Method: operations applicable to the object is
concerned.
Objects that have the type of values and methods that
are grouped in one class. Here is similar to abstract
classes in programming languages.
Sending a message : an object can access the data of a
another just by calling a method of the object.

23

MAHASISWA

MATA KULIAH

Nama
Tgl_lahir
Alamat
NoHp
JenisKelamin
Gol_darah

Kode_MK
Nama_MK
Sks
Semester

Hitung IP
Mengambil MataKuliah

Pembayaran

24

Model Relational

The relational data model describes the


data in a tabular format.
Associations between tables is defined
through the use of a key (foreign key)
Using this model, the search field of a
table or multiple tables can be done
quickly. Searches related attributes in
different tables can be done by connecting
these tables using the same attributes
(joint operation).
25

Example

26

MODEL HIERARCHY

Resembles an inverted tree


Using the pattern of parent-child relationship.
At the top of the hierarchy is called the root (root).
Each top-level entity (parent) has one or more subentity (children) so that each entity can have only
one parent, but it can have many children.
In the hierarchical data model, relationships
between entities expressed in the many (one to
many) or a one-on-one. In the university there are
many faculty and each Faculty there are many
many lecturers or students, and so on. The arrows
indicate the degree of connectedness "a lot".

27

28

Network Model

This model is similar to a hierarchical model. The


difference in this model each entity can have
many parent and children.

In this model there are fewer data


duplicates, but there are more relationships
between entities, so it will add relationship
information that must be stored in the
database. this will increase the volume and
complexity of data file storage.
29

30

Database Language

A number of commands (statement) is


formulated and can be processed to perform
a certain action.
Example of database language: SQL, dBase,
Quel
Divided into 2:
- Data Definition Language (DDL)
- Data Manipulation Language (DML)

31

Data Definition Language (DDL)

Is the command that serves to specify the


schema / database structure

create a table
delete a table
create a constraint (primary key &foreign key)

DCL (Data Control Language) included in


DDL
Sub language to control the internal structure of

the database.
DCL relies heavily on vendors

32

Data Manipulation Language (DML)

Useful for manipulation and retrieval (query)


data in the database. Manipulation of the
data could be:
- Insertion / addition of new data
- Deletion of data from a table
- Editing data from a database

33

Database design process

Requirements analysis
User needs; what must database do?

Conceptual design

Next Lecture

High-level description; often using E/R model

Logical design
Translate E/R model into (typically) relational schema

Schema refinement
Check schema for redundancies and anomalies

Physical design/tuning
Consider typical workloads, and further optimise

34

The Fundamental Tradeoff of


Database Performance Tuning

De-normalized data can often result in faster


query response
Normalized data leads to better transaction
throughput, and avoids update anomalies
(corruption of data integrity)

35

Design Heterogeneity
De-normalized Derived Tables
--- for fast access

Database system design from


the European
Bioinformatics Institute (Hinxton UK)

Other archives
Database
design

ha
n

Development
DB

ge

Q/C etc

Production DB

End Users

ex
c

Submission tools

Submitters

Da
ta

Service Tools

Normalized Tables

Service DB

D
at
aD
ist
Add value
rib
.
(computation)

Add value (review etc.)

Releases
Releases
&
&
Updates
Updates
36

End of Chapter 1

Вам также может понравиться