Anda di halaman 1dari 49

DATABASE

MANAGEMENT
SYSTEM
Session 2
Contoh Aplikasi Basis Data

• Pembelian dari supermarket


• Pembelian menggunakan kartu kredit
• Pemesanan liburan di agen perjalanan
• Menggunakan perpustakaan setempat
• Mengambil asuransi
• Menyewa video
• Menggunakan internet
• Belajar di universitas
Pembelian dari supermarket
• Kasir menggunakan pembaca kode barcode untuk memindai
setiap pembelian Anda → untuk mengetahui harga barang &
mengurangi stoknya
• Jika tingkat pemesanan ulang berada di bawah ambang batas
tertentu → secara otomatis melakukan pemesanan item
yang baru
• Periksa ketersediaan barang melalui layanan pelanggan
Pembelian menggunakan kartu kredit
• Untuk memeriksa apakah Anda
memiliki sisa kredit yang cukup,
dengan menggunakan nomor kartu
kredit Anda untuk memeriksa apakah
pembelian terakhir Anda bersama
dengan jumlah pembelian yang telah
Anda lakukan bulan ini berada dalam
batas kredit Anda. Ketika pembelian
dikonfirmasi, detail pembelian dicatat.
• Untuk memeriksa apakah kartu kredit
tidak ada dalam daftar kartu yang
dicuri atau hilang sebelum
mengesahkan pembelian.
• Ada program aplikasi lain untuk
mengirimkan laporan bulanan ke
masing-masing pemegang kartu dan ke
akun kredit saat pembayaran diterima.
Pemesanan liburan di agen perjalanan
• Ketika Anda memesan liburan Anda, sistem database harus membuat semua
pengaturan pemesanan yang diperlukan → untuk memastikan bahwa dua
agen yang berbeda tidak memesan liburan yang sama atau memesan kursi
berlebih di dalam penerbangan.
• Misalnya, jika hanya ada satu kursi yang tersisa dalam penerbangan dari
London ke New York dan dua agen mencoba untuk memesan kursi terakhir
pada saat yang sama, sistem harus mengenali situasi ini, memungkinkan
satu pemesanan untuk melanjutkan, dan menginformasikan yang lain agen
yang sekarang tidak ada kursi yang tersedia.
• Agen perjalanan mungkin memiliki database lain, biasanya terpisah, untuk
faktur.
Menggunakan perpustakaan setempat
• Akan ada indeks terkomputerisasi yang memungkinkan pembaca
menemukan buku berdasarkan judulnya, atau penulisnya, atau bidang
subjeknya.
• Sistem basis data menangani reservasi untuk memungkinkan pembaca
memesan buku dan diinformasikan melalui surat ketika buku tersedia.
• Sistem ini juga mengirimkan pengingat kepada peminjam yang gagal
mengembalikan buku pada saat jatuh tempo.
• Biasanya, sistem akan memiliki pembaca kode barcode, mirip dengan yang
digunakan oleh supermarket yang dijelaskan sebelumnya, yang digunakan
untuk melacak buku yang masuk dan keluar dari perpustakaan.
Belajar di universitas
• Akan ada sistem database yang berisi informasi tentang diri Anda, Mata
kuliah tempat Anda mendaftar, rincian tentang pembayaran Anda, modul
yang telah Anda ambil tahun-tahun sebelumnya atau yang Anda ambil tahun
ini, dan perincian semua hasil ujian Anda.
• Mungkin juga ada database yang berisi perincian yang berkaitan dengan
penerimaan tahun depan.
• Database yang berisi perincian staf yang bekerja di universitas, memberikan
perincian pribadi dan perincian terkait gaji untuk kantor penggajian.
File-Based Systems
• Kumpulan program aplikasi yang melakukan layanan untuk
pengguna akhir (mis. Laporan).

• Setiap program mendefinisikan dan mengelola datanya


sendiri.
File-Based Processing
Keterbatasan File-Based Approach
• Pemisahan dan isolasi data
Setiap program mengelola set datanya sendiri.
Pengguna dari satu program mungkin tidak mengetahui
data yang berpotensi berguna yang dimiliki oleh program
lain.
• Duplikasi data
Data yang sama dipegang oleh berbagai program.
Ruang yang terbuang dan nilai yang berpotensi berbeda
dan / atau format berbeda untuk item yang sama.
Keterbatasan File-Based Approach
• Ketergantungan data
– Struktur file didefinisikan dalam kode program.

• Format file tidak kompatibel


– Program ditulis dalam bahasa yang berbeda, sehingga
tidak dapat dengan mudah mengakses file satu sama
lain.

• Memperbaiki Kueri / Proliferasi program aplikasi


– Program ditulis untuk memenuhi fungsi tertentu.
– Setiap persyaratan baru memerlukan program baru.
Pendekatan Database

Kebutuhan terhadap database:


• Definisi data tertanam dalam program aplikasi,
daripada disimpan secara terpisah dan mandiri.
• Tidak ada kontrol atas akses dan manipulasi data di
luar yang diberlakukan oleh program aplikasi.

• Hasil:
The Database Management System (DBMS).
Database
• Kumpulan bersama data yang terkait secara logis (dan
deskripsi data ini), dirancang untuk memenuhi kebutuhan
informasi organisasi.

• Katalog sistem (metadata) menyediakan deskripsi data untuk


memungkinkan kemandirian program-data.

• Data yang terkait secara logis terdiri dari entitas, atribut, dan
hubungan informasi organisasi.
Database Management System (DBMS)
• Sistem perangkat lunak yang memungkinkan pengguna untuk
mendefinisikan, membuat, memelihara, dan mengontrol akses ke
database.

• Program aplikasi Database: program komputer yang berinteraksi


dengan database dengan mengeluarkan permintaan yang sesuai
(SQL Statement) ke DBMS.
Database Management System (DBMS)
Database Approach
• Data definition language (DDL).
– Permits specification of data types, structures and any data
constraints.
– All specifications are stored in the database.
– Example: CREATE, ALTER, DROP
– To add, modify, delete Database Object (Table, View, User, etc)
• Data manipulation language (DML).
– General enquiry facility (query language) of the data.
– Example: INSERT INTO...VALUES,
– UPDATE..SET... <WHERE>, DELETE <WHERE>,
SELECT...FROM...<WHERE>
– To add, modify, delete, retrieve record/tuple/row
Database Approach
• Controlled access to database may include:
– a security system
– an integrity system
– a concurrency control system
– a recovery control system
– a user-accessible catalog.
Views
• Allows each user to have
his or her own view of
the database.

• A view is essentially some


subset of the database.
Benefits of View
• Reduce complexity
• Provide a level of security
• Provide a mechanism to customize the
appearance of the database
• Present a consistent, unchanging picture
of the structure of the database, even if
the underlying database is changed
Components of DBMS Environment

• Hardware
– Can range from a PC to a network of computers.
• Software
– DBMS, operating system, network software (if necessary) and
also the application programs.
• Data
– Used by the organization and a description of this data called the
schema.
Components of DBMS Environment
• Procedures
– Instructions and rules that should be applied to the design
and use of the database and DBMS.
• People
Roles in the Database Environment
• Data Administrator (DA)
– is responsible for the management of the data resource including
database planning, development and maintenance of standards,
policies and procedures, and conceptual/logical database design.
• Database Administrator (DBA)
– is responsible for the physical realization of the database, including
physical database design and implementation, security and
integrity control, maintenance of the operational system, and
ensuring satisfactory performance of the applications for users
(technically oriented).
Roles in the Database Environment
• Database Designers (Logical and Physical)
– The logical database designer is concerned with identifying the data
(that is, the entities and attributes), the relationships between the
data, and the constraints on the data that is to be stored in the
database (must have a thorough and complete understanding of
the organization’s data and any constraints/business rules on this
data).
– The physical database designer decides how the logical database
design is to be physically realized. This involves: (a) mapping the
logical database design into a set of tables and integrity constraints;
(b) selecting specific storage structures and access methods for the
data to achieve good performance; (c) designing any security
measures required on the data.
Roles in the Database Environment
• Application Developers/Programmers
– Implement the application programs that provide the required
functionality for the end-users.
• End Users (naive and sophisticated)
– Naïve users are typically unaware of the DBMS. They access the
database through specially written application programs that
attempt to make the operations as simple as possible. For example,
the checkout assistant at the local supermarket.
– The sophisticated end-user is familiar with the structure of the
database and the facilities offered by the DBMS → may use a high-
level query language such as SQL to perform the required
operations or even write application programs for their own use.
History of Database Systems
• First-generation
– Hierarchical and Network

• Second generation
– Relational

• Third generation
– Object-Relational
– Object-Oriented
Advantages of DBMS
• Control of data redundancy
• Data consistency
• More information from the same amount of data
• Sharing of data
• Improved data integrity
• Improved security
• Enforcement of standards
• Economy of scale
Advantages of DBMS
• Balance conflicting requirements
• Improved data accessibility and responsiveness
• Increased productivity
• Improved maintenance through data independence
• Increased concurrency
• Improved backup and recovery services
Disadvantages of DBMS
• Complexity
• Size
• Cost of DBMS
• Additional hardware costs
• Cost of conversion
• Performance
• Higher impact of a failure
Objectives of Three-Level Database
Architecture
• All users should be able to access same data.
• A user’s view is immune to changes made in other views.
• Users should not need to know physical database storage
details.
• DBA should be able to change database storage structures
without affecting the users’ views.
• Internal structure of database should be unaffected by
changes to physical aspects of storage.
• DBA should be able to change conceptual structure of
database without affecting all users.
Three-Level Database Architecture

The ANSI-SPARC Three Level Architecture


ANSI-SPARC Three-Level Architecture
• External Level
– Users’ view of the database.
– Describes that part of database that is relevant to a particular user.

• Conceptual Level
– Community view of the database.
– Describes what data is stored in database and relationships among
the data.

• Internal Level
– Physical representation of the database on the computer.
– Describes how the data is stored in the database.
Differences between Three Levels of ANSI-SPARC
Architecture
Data Independence and the ANSI-SPARC Three-Level
Architecture
Data Independence
• Logical Data Independence
– Refers to immunity of external schemas to changes in conceptual
schema.
– Conceptual schema changes (e.g. addition/removal of entities).
– Should not require changes to external schema or rewrites of
application programs.

• Physical Data Independence


– Refers to immunity of conceptual schema to changes in the internal
schema.
– Internal schema changes (e.g. using different file organizations, storage
structures/devices).
– Should not require change to conceptual or external schemas.
Database Languages
• Data Definition Language (DDL)
– Allows the DBA or user to describe and name entities, attributes, and
relationships required for the application
– plus any associated integrity and security constraints.
– CREATE, ALTER, DROP

• Data Manipulation Language (DML)


– Provides basic data manipulation operations on data held in the database.
– INSERT, UPDATE, DELETE, SELECT

• Data Control Language (DCL)


– Manages user access
– GRANT, REVOKE
Database Languages
• Procedural DML
– allows user to tell system exactly how to manipulate data.
– For example: Relational Algebra

• Non-Procedural DML
– allows user to state what data is needed rather than how it is
to be retrieved.
– For example: Relational Calculus

• Fourth Generation Languages (4GLs)


Data Model
• Integrated collection of concepts for describing data,
relationships between data, and constraints on the data
in an organization.

• Data Model comprises:


– a structural part;
– a manipulative part;
– possibly a set of integrity rules.
Data Model
• Purpose à To represent data in an understandable way.
• Categories of data models include:
– Object-Based Data Models
• Entity-Relationship
• Semantic
• Functional
• Object-Oriented.
– Record-Based Data Models
• Relational Data Model
• Network Data Model
• Hierarchical Data Model.
– Physical Data Models
Relational Data Model
Network Data Model
Hierarchical Data Model
Conceptual Modeling
• Conceptual schema is the core of a system supporting all user
views.
• Should be complete and accurate representation of an
organization’s data requirements.
• Conceptual modeling is process of developing a model of
information use that is independent of implementation details.
• Result is a conceptual data model.
Functions of a DBMS
• Data Storage, Retrieval, and Update.
• A User-Accessible Catalog.
• Transaction Support.
• Concurrency Control Services.
• Recovery Services.
• Authorization Services.
• Support for Data Communication.
• Integrity Services.
• Services to Promote Data Independence.
• Utility Services.
System Catalog
• Repository of information (metadata) describing the data in
the database.
• One of the fundamental components of DBMS.
• Typically stores:
– names, types, and sizes of data items;
– constraints on the data;
– names of authorized users;
– data items accessible by a user and the type of access;
– usage statistics.
Components of a DBMS
• Major components of a DBMS:
§ Query processor
§ Database manager (DM)
§ File manager
§ DML preprocessor
§ DDL compiler
§ Catalog manager
Components of a DBMS
Components of Database Manager (DM)
§ Major software components for database manager
§ Authorization control § Transaction manager
§ Command processor § Scheduler
§ Integrity checker § Recovery manager
§ Query optimizer § Buffer manager
Components of
Database Manager (DM)
End of Session 2

Anda mungkin juga menyukai