Introduction to Database Indra Budi [email protected] CS - UI.

30
Introduction to Database Indra Budi [email protected] CS - UI

Transcript of Introduction to Database Indra Budi [email protected] CS - UI.

Page 1: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Introduction to Database

Indra Budi

[email protected]

CS - UI

Page 2: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Why Use A Database ?

Redundancy (duplication of data)• wasteful of space (storage)• update inefficiencies

(when a dept’s name change, the "record" must be changed each place it is stored)

• data inconsistency (simple keying mistake in the dept name, accidentally have a IS as well as CS, users will wonder whether we have new dept or it’s a mistake) we chose dept from existing dept

Page 3: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

List of Teacher Salary & BonusName Address Phone

OfficeSalary Bonus Dept.

Sill, Bill 1 Apple Rd.

07145 $54,613 $27,502 CS

Lan, Jackie

18 Lord Rd.

07122 $46,215 $28,102 Politics

James, Hal

17 Main Street

07122 $48,112 $24,016 Politics

Lan, Hennie

20 Lord Rd.

07145 $44,000 $22,032 CS

Gold, Amy

21 Dear Lane

07122 $42,465 $26,217 Politics

Doe, John

4 High Street

07102 $40,810 $25,419 Economics

Page 4: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

The Main Purpose of Database

Page 5: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Applications of databases

• Banks

• Hospital

• Library

• Supermarket

• Magazine & newspaper subscriptions

Page 6: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Extensions

• Multimedia databases

• Geographic Information Systems

• Data warehouse

• On-line analytical processing (OLAP)

• Active & real-time databases

Page 7: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Definition

• Collection of related data which has meaning

• What is data ?• Known facts that can be recorded and that have

implicit meaning• Examples: names, phone number, address the

people

• Those data can be recorded using Ms-Access, Excel, Dbase, etc.

Page 8: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Properties

• Represents some aspect of the real world, called miniworld or Universe of Discourse

• Logically coherent collection of data with some inherent meaning

• Designed, built and populated for specific purpose

Page 9: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

More Properties

• Small database: phonebook on your handphones!

• Large & complex database: tax office database

• Why is it much more complex?• The database may be generated and maintain

manually or computerized • Manually ?• Computerized ?

Page 10: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

DBMS

Database Management System is a collection of softwares that facilitates the process of • defining,

• constructing and

• manipulating

database for various applications

Page 11: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Database System Environment

Page 12: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Component of A Database System

Page 13: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

‘University’ database example

• Has 5 files (‘tables’): • Student

• Course

• Section

• Grade Report

• Prerequisite

• See how do they relate to each other!

• How do we define, construct & manipulate?

Page 14: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Page 15: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Characteristic of Database Approach

• Self describing nature

• Insulation between program and data

• Support of multiple views of data

• Sharing of data & multiuser transaction processing

Page 16: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Self describing nature

• As oppose to unstructured data

• Meta-data describes the structure of the database

• In traditional file processing, data definition is part of the application program

Page 17: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Insulation between programs & data

• Changes to the data structure does not generally require changing the program

• For example, adding a new field ‘Birthday’• The ‘data structure’ is not in the program• We call this program-data independence• DBMS provides conceptual representation• User or programmer does not need to know

how the DBMS store the data in the disk / file.

Page 18: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Multiple Views

Page 19: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Sharing & Multiuser

• DBMS provides concurrency control to ensure ‘correct’ behavior when multiple users update the same database

• Example: airline seat reservation

• It is called On-Line Transaction Processing (OLTP)

Page 20: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

The Actors

• Database administrator• Authorizing access rights

• Database designers• Defines the structure of data to be stored

• End users:• Sophisticated non-programmer users

• Naïve users

• Application programmers

Page 21: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Advantages of Using a DBMS

• Controlling redundancy• Restricting unauthorized access• Provides persistent storage for data

structures• Permits inferencing• Multiple user interfaces• Represents complex relations amongst data• Enforcing integrity constraints• Provides backup & recovery

Page 22: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Implications of Database to Organizations

• Could enforce standards

• Reduce application development time

• Flexibility

• Availability of up-to-date information

• Economies of scale

Page 23: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

History of Database Processing

Page 24: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Early Database Models

• Before mid-1960s, only sequential file processing using magnetic tape was possible

• In mid-1960s, disk storage enabled hierarchical and network database • IBM’s DL/I (Data Language One)

• CODAYSL’s DBTG (Data Base Task Group) model the basis of current DBMSs

Page 25: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

The Relational Model

• E.F. Codd introduced the relational model in 1970

• DB2 from IBM is the first DBMS product based on the relational model

• Other DBMS based on the relational model were developed in the late 1980s

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

Page 26: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Personal Computer DBMS

• The advent of microcomputer increases popularity of personal databases

• Graphical User Interface (GUI) make it easy to use• Examples of early DBMS products: dBase,

R:base, and Paradox

Page 27: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Object Oriented DBMS (OODBMS)

• Object-oriented programming started in the mid-1980s

• Goal of OODBMS is to store object-oriented programming objects in a database without having to transform them into relational format

• Object-relational DBMS products, such as Oracle 8i and 9i, allow both relational and object views of data on the same database

• Currently, OODBMS have not been a commercial success due to high cost of relational to object-oriented transformation

Page 28: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Recent History

• Success story of the Microsoft Access • Microsoft Office suite and Windows integration

• Easy-to-use and powerful personal DBMS

• Internet database

• XML and database integration

Page 29: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

Library Checkout List

• Sam Archer's card is lost and the card number shown must be replaced, what problem could be occur ?

• If Some Good Fiction is lost and must be removed from the list, what the problem you see will happen ?

• If a new book named Still More Good Fiction is purchased by the library, is it appear in the list ? Why ?

Name Card Number Book Due Date Joe Smith 123-450201 How To Garden 09/12/20xx Sara Jones 123-450217 Some Good Fiction 09/12/20xx Sam Archer 123-450326 How To Build Things 09/15/20xx Sam Archer 123-450326 More Good Fiction 09/15/20xx Joe Smith 123-450201 More How To Garden 09/17/20xx

Page 30: Introduction to Database Indra Budi Indra@cs.ui.ac.id CS - UI.

Database I – Introduction to Database

More Exercise…

• In a database processing system :

1. the database application(s) interact(s) with the DBMS

2. the database application(s) access(es) the database data

3. the DBMS accesses the database data

• Which one is correct ?