You are on page 1of 36

DATABASE

Chapter1: Introduction to Database and DBMS

Prepared by: Dr Ikram Mohamed Moalla


Presented By: ……………………………
CRN:…………………….

AlBaha University
2019-2020

1
1. Introduction to Database and DBMS
1. INTRODUCTION

1.1 The data

• We bathe in a large volume of information


• We receive information from our environment
• We send information to our environment
• Information takes the form of data (stored and transported on a
backing material or immaterial)
• Question: how to store and process this data?

Response: in a database

2
1. Introduction to Database and DBMS
Introduction
1.1 The data

Data is everywhere around us...

3
Introduction
1. Introduction to Database and DBMS
1.1 The data

How to store them in a computer?

4
1. Introduction to Database and DBMS
Introduction
1.1 The data
How to store them in a computer?

o scann the purchase orders [1/10]

o copy the data in a table Word [2/10]

o copy the data into an Excel sheet [4/10]

o copy the data into a database [10/10]

5
Introduction
1. Introduction to Database and DBMS
1.1 The data

Looking a little closer...

données
Client Data
du client

Order
data

Details data

6
Introduction
1. Introduction to Database and DBMS
1.1 The data
Referring these data in tables:
Order data Client data

NORDER DATEORD TOTALORDER NCLI NAME ADRESS LOCALITY

30188 2/1/2009 69720 B512 GILLET 14,r. de l'Eté Toulouse

Details data
NPRO LABEL PRICE QORDER SUB-TOTAL

CS464 CHEV. SAPIN 400x6x4 220 180 39600

PA45 POINTE ACIER 45 (2K) 105 22 2310

PA60 POINTE ACIER 60 (1K) 095 70 6650

PH222 PL. HETRE 200x20x2 230 92 21160

observations:
1. TOTALORDER and SUB-TOTAL are computed: no need to keep
2. it is impossible to reconstruct the original purchase order: who is the
Client of the order, what is the order of a detail?

7
Introduction
1. Introduction to Database and DBMS
1.1 The data

Data without redundancy and with references:

Order data Client data

NORDER NCLI DATEORDER NCLI NAME ADRESS LOCALITY

30188 B512 2/1/2009 B512 GILLET 14,r. de l'Eté Toulouse

Details data

NORDER NPRO QORDER LABEL PRICE

30188 CS464 180 CHEV. SAPIN 400x6x4 220

30188 PA45 22 POINTE ACIER 45 (2K) 105

30188 PA60 70 POINTE ACIER 60 (1K) 095

30188 PH222 92 PL. HETRE 200x20x2 230

Observation
if more details refer to the same product, its features are repeated
many times: isolated product data in a specific table

8
Introduction
1. Introduction to Database and DBMS
1.1 The data

Optimal distribution of purchase orders data

Order data Client data

NORDER NCLI DATECOM NCLI NAME ADRESS LOCALITY

30188 B512 2/1/2009 B512 GILLET 14,r. de l'Eté Toulouse

Details data Product data

NORDER NPRO QORDER NPRO LABEL PRICE

30188 CS464 180 CS464 CHEV. SAPIN 400x6x4 220

30188 PA45 22 PA45 POINTE ACIER 45 (2K) 105

30188 PA60 70 PA60 POINTE ACIER 60 (1K) 95

30188 PH222 92 PH222 PL. HETRE 200x20x2 230

9
Introduction
1. Introduction to Database and DBMS
1.1 The data
CLIENT
NCLI
Add
NAME
other data: our first database NPRO LABEL
PRODUCT
QSTOC
ADRESS LOCALITY (CAT) ACCOUNT PRICE

DETAIL
NORD NPRO QORD

ORDER
NORD NCLI DATORD

10
Introduction
I.
1. The Databases
Introduction toConcepts
Database and DBMS
1.2 Use a database
What can we do with this data?

Above all, keep them as long as necessary!

The question: what is the number, name and address of Toulouse clients?
select NCLI, NAME, ADRESS
s y
from CLIENT ea
where LOCALITY = 'Toulouse';

or: what are the Toulouse Client orders?


er
select NORDER h ard
e
ittl
al
from ORDER
where NCLI in (select NCLI
from CLIENT where LOCALITY = 'Toulouse');

queries written in SQL language


11
Introduction
1. Introduction to Database and DBMS
1.2 Use a database
What can we do with this data?

Produce invoices

Prepare the replenishment of products out of stock

Calculate monthly sales

Study the geographical distribution of sales

And a thousand other applications ...

12
Introduction
1. Introduction to Database and DBMS
1.2 Use a database
What can we do with this data?

A final example:
calculate the distribution of turnover by location and by product

select C.LOCALITY, P.NPRO, sum(D.QORD*P.PRICE)


from CLIENT C, ORDER O, DETAIL D, PRODUIT P
where C.NCLI = O.NCLI and O.NORDER = D.NORDER ng
ryi nd
e t
and D.NPRO = P.NPRO us sta t !
no nder men
group by C.LOCALITY, P.NPRO; u
to e m
o
th
at

This complex issue is resolved in a single SQL statement 5 lines!

13
Introduction
1. Introduction to Database and DBMS
1.3 First conclusions

• A database consists of a set of tables.


• Each table contains data relating to entities of the same kind.
• Each row in the table shows the data relating to an entity.
• Each column in a table describes common ownership entities.
• The rows of a table are distinct. The set of columns whose values are unique is
an identifier of the table.
• The rows of a table may refer to a respective line of another table in which
information on an associated entity can be obtained. Reference columns are
called foreign key to the other table.

14
Introduction
1. Introduction to Database and DBMS
1.3 First conclusions

• It avoids storing data that can be calculated from other data recorded.
• Is not kept in a table of data relating to entities of different nature. It would
cause redundancies.
• The SQL language is used to write a simple and concise way of extraction and
queries of any complexity calculation data.
• You do not build a database to meet the immediate needs of a particular
application. A database is designed to reflect as closely as possible the
information related to human activity, socio-economic, cultural or technical. It is
independent of what will be done of such data.
• Building a database requires rigorous and careful analysis. It is possible at any
time to add new tables and new columns to track the evolution of user needs.

15
Introduction
1. Introduction to Database and DBMS
1.4 Database management systems DBMS

Managing a database pose complex problems.


This is managed by specialized software: database management systems or
DBMS.

Data Organization: the DBMS organizes data in tables and columns.

Data management: changing the DBMS ensures data consistency; it checks the
constraints (uniqueness, reference between tables, etc.).

Data access: the DBMS allows access to data from both the casual user and the
data processing programs.

16
Introduction
1. Introduction to Database and DBMS
1.4 Database Management Systems DBMS

Managing concurrency: the DBMS allows simultaneous data access by hundreds


or thousands of users. It strictly controls simultaneous operations on the same data.

Access controls: the DBMS ensures that only authorized users can access data
and change.

17
Introduction
1. Introduction to Database and DBMS
Labs: DBMS Oracle 11g Express Edition

Documentation
http://docs.oracle.com/cd/B25329_01/doc/admin.102/b25610/toc.htm

Download

http://www.oracle.com/technetwork/database/database10g/
overview/index-095623.html

18
1. Introduction to Database and DBMS
History of Database Systems

Early Manual System

Before-1950s
• Data was stored as paper records.
• Lot of man power involved.
• Lot of time was wasted.
e.g. when searching
• Therefore inefficient.

19
1. Introduction to Database and DBMS
History of Database Systems

Revolution began

o 1950s and early 1960s:


• Data processing using magnetic tapes for storage
• Tapes provide only sequential access
• Punched cards for input
o Late 1960s and 1970s:
• Hard disks allow direct access to data
• Data stored in files
• Known as File Processing System

20
1. Introduction to Database and DBMS
History of Database Systems

File based systems

o Adequate for small applications

Drawbacks
o Separation and isolation of data
• Each program maintains its own set of data.
• Users of one program may be unaware of
potentially useful data held by other programs.

21
1. Introduction to Database and DBMS
History of Database Systems

File based systems (contd.)

o Duplication of data
• Same data is held by different locations.
• Wasted space and potentially different values and/or
different formats for the same item.
o Data dependence
• File structure is defined in the program code.

22
1. Introduction to Database and DBMS
History of Database Systems

File based systems (contd.)

o Incompatible file formats


• Programs are written in different languages, and so
cannot easily access each other’s files.

o Fixed Queries/Proliferation of application programs


• Programs are written to satisfy particular functions.
• Any new requirement needs a new program.

23
1. Introduction to Database and DBMS
Database Approach

Arose because:

Definition of data was embedded in application programs, rather than


being stored separately and independently.
􀁺 No control over access and manipulation of data beyond that
imposed by application programs.
Result:
The database and Database Management System (DBMS).

24
1. Introduction to Database and DBMS
Database Management Systems (DBMS)

25
1. Introduction to Database and DBMS
Hierarchical Model

o Well suited for data which are in some way related

o Hierarchically begin with a strictly defined tree of data nodes

o Each node can contain some identifying data, plus a set of


subnodes of a specific child type

26
1. Introduction to Database and DBMS
Hierarchical Model (Contd.)
Hypothetical Hierarchical Database Model

27
1. Introduction to Database and DBMS
Network Model

o Supported more complex relations

o Physical file pointers were used to model the relations between


files

o Relations had to be decide in advance

o Most suitable for large databases with well defined queries and
welldefined applications.

28
1. Introduction to Database and DBMS
Network Model (Contd.)

29
1. Introduction to Database and DBMS
Relational Model (1970’s)

o E.F. Codd introduced the relational


model in 1970

o Provides a conceptually simple model for data as


relations
(typically considered “tables”) with all data visible.

o DB2 from IBM is the first DBMS product based on the


relational model

30
1. Introduction to Database and DBMS
Relational Model (Contd.)

31
1. Introduction to Database and DBMS
Relational Model (Contd.)

o Other DBMS based on the relational model were developed


in the late 1980s

o Today, DB2, Oracle, and SQL Server are the most prominent
commercial DBMS products based on the relational model

32
1. Introduction to Database and DBMS
Object Oriented Data Model (1990’s)

􀁻 Goal of OODBMS is to store objectoriented programming


objects in a database without having to transform them into
relational format.

􀁻 Extend the entity-relationship data model by including


encapsulation, methods and object identity

33
1. Introduction to Database and DBMS
Object-relational models

Extend the relational data model by including object orientation


and constructs to deal with added data types.
􀁻 Allow attributes of tuples to have complex types, including non-
atomic values such as nested relations.
􀁻 Preserve relational foundations, in particular the declarative
access to data, while extending modeling power.

34
1. Introduction to Database and DBMS
Object-relational models

o Extend the relational data model by including object orientation


and constructs to deal with added data types.

o Allow attributes of tuples to have complex types, including non-


atomic values such as nested relations.

o Preserve relational foundations, in particular the declarative


access to data, while extending modeling power.

35
1. Introduction to Database and DBMS
Modern Database Management Systems

o DBMS are large complex pieces of software designed


specifically for the efficient management of data.

o Examples:
• Oracle (Oracle Corporation)
• Ingres (Computer Associates)
• SQL Server (Microsoft Corporation)
• Access (Microsoft Corporation)
• IMS, DB2 (IBM)
• And many more…

36
1.
I. The
Introduction
Databasesto Concepts
Database and DBMS

You might also like