Data Design

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Database Analysis and Design

1
Learning Objectives
 Pemahaman Dasar
 Pentingnya Data Modeling
 Membuat penamaan yang tepat untuk
entitas, relationship dan atribute.
 Mampu menggambar diagram E-R untuk
kondisi bisnis normal.
 Menerapkan business rules dalam ER
 Mengubah ERD menjadi relasional table
 Data Normalization

1-Apr-14 2
The Data Hierarchy

 Data field is the smallest unit of data.


 Record is a collection of related data fields.
 File is a collection of related records.
 Database is a collection of related files.
– General definition
– Restrictive definition

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 3 McLeod and George Schell
Database

 Table of rows and columns can be represented in


a spreadsheet.
 Relational database structure is conceptually
similar to a collection of related tables.
 Flat file is a table that does not have repeating
columns; 1st normal form.
 Normalization is a formal process for eliminating
redundant data fields while preserving the ability of
the database to add, delete, and modify records
without causing errors.

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 4 McLeod and George Schell
Figure 6.1 Spreadsheet
Example of the COURSE Table

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 5 McLeod and George Schell
Database (Cont’d)

 Key in a table is a field (or combination of fields)


that contain a value that uniquely identifies each
record in the table.
 Candidate key is a field that uniquely identifies
each table row but is not the chosen key.
 Relating tables is done through sharing a common
field and the value of the field determines which
rows in the tables are logically joined.

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 6 McLeod and George Schell
Database Structures

 Database management system (DBMS) is


a software application that stores the
structure of the database, the data itself,
relationships among data in the database,
and forms and reports pertaining to the
database.
– Self-describing set of related data.

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 7 McLeod and George Schell
Hierarchical Database
Structures
 Hierarchical is formed by data groups,
subgroups, and further subgroups; like
branches on a tree.
– Worked well with TPSs
– Utilized computer resources efficiently
 Network allows retrieval of specific records;
allows a given record to point to any other
record in the database.

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 8 McLeod and George Schell
Figure 6.2 The Hierarchical Structure
Between the DEPARTMENT and
COURSE Tables

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 9 McLeod and George Schell
Database Structures (Cont’d)

 Relational is when the relationship between


tables are implicit.
 Physical relationship is when the database
structure (hierarchical, network) rely on
storage addresses.
 Implicit relationship is when the database
structure (relational) can be implied from the
data.
Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 10 McLeod and George Schell
A Relational Database
Example
 A database named Schedule has been
created from tables used earlier in the
chapter and some others
 The database is implemented in Microsoft
Access 2002 (also known as Access XP).
 Databases break information into multiple
tables because if information were stored in
a single table, many data field values would
be duplicated.
Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 11 McLeod and George Schell
The Schedule Database

 The example is implemented on Microsoft Access DBMS


but would be similar on any relational DBMS product.
 The COURSE table in Access (Figure 6.4) is a list of data
field values. The table itself had to be defined in Access
before values were entered into the data fields.
 Figure 6.5 shows the definition of the Code field.
 Figure 6.6 illustrates that Abbreviation field values will be
looked up from a list of values in the DEPARTMENT table.
 Table 6.7 shows a single table of course and department
fields before they were separated into different tables.

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 12 McLeod and George Schell
Figure 6.4 The COURSE Table
in Access

Management Information
Systems, 10/e Raymond
© 2007 by Prentice Hall 13 McLeod and George Schell
Hirarki Data: Database Oriented Approach

1-Apr-14 14
Data Modeling
 Data modeling – teknik untuk mengorganisasi dan
mendokumentasikan data sistem
 Bagian dalam fase analisis dalam pengembangan
database atau sistem informasi
 Analisis – Design – Implementation

1-Apr-14 15
Data Modeling
 Entity Relationship Model (ERD): Teknik
menggambarkan konsep/konstruk dalam dunia
ke dalam model yang perlu disimpan.
– Entity
– Relationship
– Key
– Attribute
– Cardinality
 Memiliki standar pemodelan yang diterima luas.
 ...dengan teknik2 yang berbeda

1-Apr-14 16
Relationship symbols

Entity
symbols Attribute
symbols

A special
entity that is
also a
Relationship
relationship
degrees
specify
number of
entity types
Relationship
involved
cardinalities
specify how
many of each
entity type is
allowed

1-Apr-14 17
Contoh Unary Relationship

ORANG Menikah_dengan PEGAWAI Membawahi

SUKU_CADANG Tersusun_atas
Contoh Binary Relationship

ORANG Diberi_jatah TEMPAT PARKIR

PEGAWAI Bekerja_pada DEPARTEMEN

MAHASISWA Mengambil MATA KULIAH


Contoh Ternary Relationship

PEMASOK Memasok GUDANG

BARANG

 Sebuah Pemasok memasok sejumlah barang pada beberapa gudang


 Sebuah barang bisa dipasok oleh beberapa Pemasok
Kardinalitas Hubungan

Selalu hanya satu

Satu atau banyak

Nol atau satu

Nol, satu, atau banyak


Entitas Lemah

 Entitas kuat versus entitas lemah


– Entitas kuat (strong entity) adalah entitas yang
keberadaannya tidak bergantung pada tipe entitas lain
– Entitas lemah (weak entity) adalah entitas yang
keberadaannya bergantung pada tipe entitas lain
– Entitas yang menjadi ketergantungan dari entitas lemah
dinamakan indentifying owner
– Hubungan antara tipe entitas lemah dan pemiliknya
dinamakan identifying relationship
Entitas Lemah (Lanjutan…)

Nomor_Peg Nama_Peg Nama_Tanggungan Tanggal_Lahir

PEGAWAI Memiliki TANGGUNGAN


Contoh Lain Entitas Lemah

 Pada universitas, MATAKULIAH adalah


entitas kuat, sedangkan MATAKULIAH
DITAWARKAN adalah entitas lemah
Data Modeling
 Entity instance – satu kejadian tunggal suatu
entitas. Digambarkan dalam bentuk “baris”

Student Last First ENTITY


ID Name Name
2144 Arnold Betty INSTANCE

3122 Taylor John


3843 Simmons Lisa
9844 Macy Bill
2837 Leath Heather
2293 Wrench Tim

1-Apr-14 25
Memecahkan many-to-many dengan associative entity

Order Produk

Order_Id: Produk_Nm

11 Buku
22 Alat Tulis
33 Map
44 Alat Gambar
55 Tas
Bagaimana carabe
You gotta menampilkan
confused!!! atau
menjelaskan 100.000 order dan 10.000 produk?

1-Apr-14 26
Memecahkan many-to-many dengan associative entity

Baris
Order Produk
Order

Order_Id: Order_id + Produk_Nm Produk_Nm


11+Buku
11 Buku
11+Alat Tulis
22 22+Alat Tulis Alat Tulis
33 33+Buku Map
44 33+Gambar Gambar
44+Alat Tulis
55 Tas
44+Gambar
55+Map
55+Tas

1-Apr-14 27
MS Access

1-Apr-14 28
Memecahkan many-to-many dengan associative entity

Mhsw Mat.Kul

Mhsw KRS Mat.Kul

Bukan selalu Perlu dipecahkan


assoc.entity dengan
assoc.entity

Baris
Mhsw KRS Mat.Kul
KRS

1-Apr-14 29
Pentingnya model data
 Data model
– Representasi yg relatif sederhana dari struktur data
dunia nyata yang kompleks; biasanya berbentuk grafis.
– Communications tool to facilitate interaction among the
designer, the applications programmer, and the end user
 Rancangan database yang baik yang
menggunakan model data sebagai landasannya
 Pengguna akhir memiliki pandangan dan
kebutuhan data yang berbeda
 Model data mengorganisasikan data untuk
berbagai pengguna
 Accounting is about data model and process model

1-Apr-14 30
Sumber Business Rules
 Company managers
 Policy makers
 Department managers
 Written documentation
– Procedures
– Standards
– Operations manuals
 Direct interviews with end users

1-Apr-14 31

You might also like