Fundamentals ofDatabase Systems
1
MotivationFundamentals of Database Systems
• Desain dan implementasi komponen database adalah aspek yang paling penting dari pengembangan sistem Informasi
• Keberhasilan sistem informasi tergantung pada desain database!
2
I think our smaller sized cans of
drink are selling faster than the
larger ones. Can you give me a
breakdown?
Sorry but we can only obtain
reports showing total cans
sold to each store.
Contents
Fundamentals of Database Systems
• Introduces the concept of a database
• Introduces the concept of a database management system
• Describes the functions of a database management system
3
What is a Database?
Sebuah kumpulan fakta yang saling terkait
4
Filing CabinetHard disk full of data
Diary
Library
What is a DBMS?
• DBMS - DataBase Management System
• Multiple Billion dollar market for DBMS products and services !
• Sebuah sistem perangkat lunak untuk mendefinisikan, membangun dan memanipulasi database untuk berbagai aplikasi
• DBMS may be general purpose (business applications) or special purpose (biological databases, geographic information, ...)
5
The DBMS facilitates ...
• Defining a database
– Specifying the types, structures, and
constraints for the data
• Constructing a database
– Storing the data on a storage medium
• Manipulating a database
– Querying and updating the database
6
What is a Database System?
7
Application Programs/Queries
Software to Process
Queries/Programs
Software to Access
Stored Data
DATABASE SYSTEM
DBMS SOFTWARE
Users/Programmers
Stored Database
Definition
(Meta-Data)
Stored
Database
DBMS
+
Database
=
Database System
Database System Components• The Stored Database
– A collection of related facts• The DBMS
– The software that defines, constructs and manipulatesa database
• The Applications– The programs (in specific languages) that
manipulate the database• The Users
– People who use the database system, through the DBMS interface or through application programs
8
Users of the Database System
• Database Administrators
• Database Designers and Application Programmers
• End Users
– Casual End Users
– Parametric End Users
– Sophisticated End Users
9
Why use a Database System?
• The database approach provides a centralstore of data and meta-data, and thus– Is not internal to an application program, as in
traditional file processing environments– Menyediakan berbagi akses untuk beberapa
pengguna– Relieves the application programmer from various
tedious book keeping tasks– Menyediakan fasilitas untuk mengubah data tanpa
mempengaruhi aplikasi
10
The DBMS Software
11
DBA Staff
DDLStatements
PRIVILEGED
COMMANDS
DDLCompiler
Stored Data
Manager
Interactive
Query
DML
Statements
Precompiler
Application
Programs
Runtime
Database
Processor
Query
Compiler
Canned
Transactions
Host
Language
Compiler
Concurrency Control
Backup/ Recovery/Subsystems
DML
Compiler
System
Catalog
Stored Database
Casual Users
Application Programmers
Parametric
Users
o
o
o
o
o
Execution
Execution
Execution
Typical Functions of the DBMS
• Controlling redundancy
• Restricting unauthorized access
• Providing multi-user interfaces
• Representing complex relationships
• Enforcing integrity constraints
• Providing backup and recovery
12
Controlling redundancy• Pengguna sistem pemrosesan berkas
tradisional, masing-masing memiliki sebuah "copy" data yang relevan, menyebabkan
– Duplication of effort
– Pemborosan ruang penyimpanan
– Inconsistent data
• Namun, kadang-kadang redundansi meningkatkan kinerja - DBMS menyediakan lingkungan di mana redundansi dapat dikendalikan
13
Stud-No Name Degree Subject Grade
90 Smith BA CS182 7
87 Brown BA CS182 7
98 James BSc CS181 6
90 Smith BIT CS181 6
Stud-No Name Degree Finance-Type
90 Smith BIT Self
87 Brown BA UQ Scholar
98 Harrison BSc Self
Restricting unauthorized access
Kelompok pengguna yang berbeda mungkin memiliki hak akses yang berbeda (Create / Alter, Update, dan Retrive), yang dikendalikan melalui DBMS sub-system Security, melalui penggunaan Akun & Sandi
• Pengguna “Casual” mungkin tidak memiliki akses ke data rahasia, misalnya catatan medis, paket gaji, laporan polisi
• Pengguna “Parametric” dapat diberikan akses update, tetapi umumnya tidak diperbolehkan untuk mengubah struktur data
• Database administrator (DBA) umumnya memiliki hak istimewa tertinggi, membuat account pengguna dan membuat pembatasan-pembatasan
14
Providing multi-user interfaces
• Query Languages for Casual End Users
• Programming Language Interfaces for Application Programmers
• Forms and Commands for Parametric Users
- Graphical User Interfaces (GUI)
- Interface for Web Enabling
- Natural Language Interfaces
15
Complex relationships
DBMS has ability to represent complex relationships among the data
16
Stud-No Name Degree Subject Grade
90 Smith BA CS182 7
87 Brown BA CS182 7
98 James BSc CS181 6
90 Smith BIT CS181 6
Sub-Code Title Credit Department
CS181 Software Eng 12 CSEE
CS182 Intro to Info Sys 12 CSEE
CO362 Business Info Sys 10 Commerce
James is doing BSc
CS181 is the code for
Software Engineering
CO362 is offered by the
Commerce Department
Enforcing integrity constraints
• The DBMS has the capability to define and enforce integrity constraints which are restrictions placed on the data, based on the semantics or meaning of the data– Every Subject must have a unique Code– A student cannot have 2 different grades for the same subject– A student cannot enroll in more than four 12-credit subjects in a semester– Student No must be a 9 digit integer
• DBMS cannot check spelling or typing errors, for example, if 5 was entered as the grade of a student getting 7 - DBMS will not identify the error!
17
Providing backup and recovery
DBMS provides facility to recover from hardware and software failures through its backup and recovery sub-system
• An update program is executing
• Computer System fails in the middle of the update
• DBMS restores the database to a state prior to the update and restarts the update program
18
Deposit $200 into ATM
system fails
Deposit not recorded in
your a/c
Review
Key definitions:
• Database
• DBMS (Many Functions)
• Database System = DBMS + Database
19
MySQL
• MySQL dikembangkan sejak sekitar 1994–1995 oleh sebuah perusahaan Swedia bernama MySQL AB, yang kala itu bernama TcX DataKonsult AB.
• MySQL versi 1.0 dirilis Mei 1996 secara terbatas kepada empat orang. Baru di bulan Oktober versi 3.11.0 dilepas ke publik.
• Bulan Juni 2000 mulai versi 3.23.19, MySQL adalah software bebas berlisensi GPL. Artinya, “Source code MySQL dapat dilihat dan gratis, serta server MySQL dapat dipakai tanpa biaya untuk kebutuhan apa pun.
20
Apa MySQL
• MySQL adalah sebuah DBMS. • MySQL adalah sebuah DBMS relational.
Terdiri dari banyak tabel yang saling berhubungan . Tabel-tabel tersebut dihubungkan oleh hubungan yang sudah didefinisikan yang memungkinkan untuk mengkombinasikan data dari beberapa tabelsesuai dengan keperluan.
• MySQL adalah ‘Open Source Software’. ‘Open Source’ maksudnya program tersebut memungkinkan untuk dipakai dan dimodifikasi oleh siapa saja. Semua orang bisa mendownload MySQL dari Internet dan memakainya tanpa membayar sepeser pun. Seseorang dapat mempelajari ‘ Source Code ‘ dan dapat mengubahnya sesuai dengan kebutuhan mereka. MySQL menggunakan GPL (GNU General Public License).
21
Mengapa menggunakan MySQL
• MySQL merupakan database yang sangat cepat, dapat diandalkan dan mudah untuk digunakan. Selain itu, source programnya pun dapat dimiliki secara gratis dan syntax-syntaxnya mudah untuk dipahami dan tidak rumit serta pengaksesan basisdata dapat dilakukan dengan mudah dan cepat.
22
Beberapa Kelebihan
• Dapat bekerja di beberapa platform yang berbeda, seperti LINUX, Windows, MacOS dll. • Dapat dikoneksikan pada bahasa C, C++, Java, Perl, PHP dan Python. • Memiliki lebih banyak type data seperti : signed/unsigned integer yang memiliki panjang
data sebesar 1,2,3,4 dan 8 byte, FLOAT, DOUBLE, CHAR, VARCHAR, TEXT, BLOB, DATE, TIME, DATETIME, TIMESTAMP, YEAR, SET dan tipe ENUM.
• Mendukung penuh terhadap kalimat SQL GROUP BY dan ORDER BY. Mendukung terhadap fungsi penuh ( COUNT ( ),COUNT (DISTINCT), AVG ( ), STD ( ), SUM ( ), MAX ( ) AND MIN ( ) ).
• Mendukung terhadap LEFT OUTHER JOIN dengan ANSI SQL dan sintak ODBC. • Mendukung ODBC for Windows (dengan source program). Semua fungsi ODBC dan
sebagainya. Sebagai contoh kita dapat menggunakan Access untuk connect ke MySQL server.
• Menggunakn GNU automake, autoconf, dan LIBTOOL untuk portabilitas. • Kita dapat menggabungkan beberapa table dari database yang berbeda dalam query yang
sama. • Ditulis dengan menggunakan bahasa C dan C++. Diuji oleh compiler yang sangat jauh
berbeda. • Privilege (hak) dan password sangat fleksibel dan aman serta mengujinkan ‘Host-Based’
Verifikasi.
23
Menjalankan MySQL
• Berbasis Teks (prompt)
Dimana semua perintah diketikkan melalui prompt. Lebih cepat dan praktis. Kekurangan harus hafal semua sintaks mysql
• Berbasis Grafik (GUI)
Memakan memori, namun lebih mudah bagi yang belum expert.
24
Berbasis Teks
25
Berbasis GUI
26