Database Relasional
Database Relasional
STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
Information about the attributes of an entity (e.g., the
student’s ID number and birth date) are stored in fields.
STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
All the fields containing data about one entity (e.g., one
student) form a record.
The example below shows the record for Artie Moore.
STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
A set of all related records forms a file (e.g., the student
file).
If this university only had three students and five fields for
each student, then the entire file would be depicted below.
STUDENTS
Phone
Student ID Last Name First Name Number Birth Date
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
A set of interrelated, centrally coordinated files forms a
database.
Student Class
File File
Advisor
File
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
DATABASE
Seperangkat koordinasi beberapa file data
terpusat yang saling berhubungan yang
disimpan dengan sedikit mungkin kelebihan
data.
FILE VS DATABASE
DATA BASE
FILE MAHASISWA
FILE KELAS FILE DOSEN
(ENTITY)
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
This proliferation of master files
Master File 1
Fact A
Enrollment created problems:
Program
Fact B Often the same information was
Fact C stored in multiple master files.
Made it more difficult to effectively
integrate data and obtain an
Master File 2
organization-wide view of the data.
Fact A Financial Aid Also, the same information may not
Fact D Program have been consistent between files.
Fact F If a student changed his phone
number, it may have been updated
in one master file but not another.
Master File 1
Grades
Fact A Program
Fact B
Fact F
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
Database
Management
System
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
The database approach
Database treats data as an
Fact A Fact B organizational resource that
Fact C Fact D should be used by and
Fact E Fact F
managed for the entire
organization, not just a
particular department.
Database
Management
A database management
System system (DBMS) serves as the
interface between the
database and the various
Enrollment Financial Aid Grades
application programs.
Program Program Program
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
FILE VS. DATABASES
Database
The person responsible
Fact A Fact B for the database is the
Fact C Fact D database administrator.
Fact E Fact F
• Hewlett-Packard is replacing
As technology improves,
784 databases with a single,
many large
company-wide companies
database.
Database
Management
are developing very
System large databases called
data warehouses.
Enrollment Financial Aid Grades
Program Program Program
© 2008 Prentice Hall Business Publishing Accounting Information Systems, 11/e Romney/Steinbart
KEUNGGULAN SISTEM DATABASE
DATA INTEGRATION (INTEGRASI DATA)
DATA SHARING (PEMBAGIAN DATA)
MINIMAL DATA REDUNDACY AND DATA
INCONSISTENCIES (MEMINIMALKAN KELEBIHAN
DAN INKONSISTENSI DATA)
DATA INDEPENDENCE (INDEPENDENSI DATA)
CROSS-FUNCTIONAL ANALYSIS (ANALISIS LINTAS
FUNGSIONAL)
PENTINGNYA DATA YANG BAIK
Data yang tidak benar pada database dapat
mengarahkan kepada :
- keputusan yang buruk
- kebingungan
- pengguna yang marah
SISTEM DATABASE
SISTEM DATABASE
Pendekatan database memberikan dua
tampilan data terpisah : tampilan fisik dan
tampilan logis
• Tampilan Fisik : Cara data secara fisik
diatur dan disimpan dalam sistem komputer
• Tampilan Logis : Bagaimana seseorang
secara konseptual mengelola, menampilkan,
dan memahami hubungan antar-item data.
Logical View—User A Logical View—User B
Scholarship Distribution
Enrollment by Class Fr.
5%
Sr. Soph.
33% 24%
Jr.
38%
Database
Logical View—User A Logical View—User B
Scholarship Distribution
Enrollment by Class Fr.
5%
Sr. Soph.
33% 24%
Jr.
38%
DBMS
The operating system
Operating translates DBMS
System requests into
instructions to
physically retrieve
data from various
Database disks.
SISTEM DATABASE
SKEMA, deskripsi elemen-elemen data dalam
database, hubungan diantara mereka, dan
model logika yang digunakan untuk mengelola
dan menjelaskan data
SKEMA
• Conceptual –level schema, tampilan organisasi
yang luas akan menampilkan keseluruhan database,
mendaftar semua elemen ata dan hubungan
diantara mereka.
• External-level schema, tampilan pengguna individu
terhadap bagian-bagian dalam database, masing-
masing mengacu pada sebuah subschema.
• Internal – level schema, tampilan level rendah
database, menjelaskan bagaimana data disimpan,
diakses, termasuk layout, catatan, definisi, alamat
dan indeks.
Subschema--User A Subschema--User B Subschema--User C
Smith . . . A
Jones . . . B
Arnold . . .D
Cash
Receipt
Cash
Receipt
Cash
Receipt
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
SCID Student ID Course
333333333-1234 333-33-3333 1234
333333333-1236 333-33-3333 1236
111111111-1235 111-11-1111 1235
111111111-1236 111-11-1111 1235
STUDENTS Each row is
Last First Phone called a tuple,
Student ID Name Name No. which rhymes
333-33-3333 Simpson Alice 333-3333 with “couple.”
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236
Each row
STUDENTS
contains data
Last First Phone about a specific
Student ID Name Name No. occurrence of
333-33-3333 Simpson Alice 333-3333 the type of entity
111-11-1111 Sanders Ned 444-4444 in the table.
123-45-6789 Moore Artie 555-5555
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236
STUDENTS Each column in
Last First Phone a table contains
Student ID Name Name No. information
333-33-3333 Simpson Alice 333-3333 about a specific
111-11-1111 Sanders Ned 444-4444 attribute of the
123-45-6789 Moore Artie 555-5555 entity.
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
A primary key is the
SCID attribute or combination
333333333-1234 of attributes that
333333333-1236 uniquely identifies a
111111111-1235 specific row in a table.
111111111-1236
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
SCID
333333333-1234 In some tables, two or more attributes
333333333-1236 may be joined to form the primary key.
111111111-1235
111111111-1236
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503
ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
• Using the suggested approach, a student taking three classes would need three
rows in the table.
• In the above, simplified example, a number of problems arise.
Last First
Student ID Name Name Phone No. Course No. Section Day Time
333-33-3333 Simpson Alice 333-3333 ACCT-3603 1 M 9:00 AM
333-33-3333 Simpson Alice 333-3333 FIN-3213 3 Th 11:00 AM
333-33-3333 Simpson Alice 333-3333 MGMT-3021 11 Th 12:00 PM
111-11-1111 Sanders Ned 444-4444 ACCT-3433 2 T 10:00 AM
111-11-1111 Sanders Ned 444-4444 MGMT-3021 5 W 8:00 AM
111-11-1111 Sanders Ned 444-4444 ANSI-1422 7 F 9:00 AM
123-45-6789 Moore Artie 555-5555 ACCT-3433 2 T 10:00 AM
123-45-6789 Moore Artie 555-5555 FIN-3213 3 Th 11:00 AM
• Suppose Alice Simpson changes her phone number. You need to make the
change in three places. If you fail to change it in all three places or change it
incorrectly in one place, then the records for Alice will be inconsistent.
• This problem is referred to as an update anomaly.
Last First
Student ID Name Name Phone No. Course No. Section Day Time
333-33-3333 Simpson Alice 333-3333 ACCT-3603 1 M 9:00 AM
333-33-3333 Simpson Alice 333-3333 FIN-3213 3 Th 11:00 AM
333-33-3333 Simpson Alice 333-3333 MGMT-3021 11 Th 12:00 PM
111-11-1111 Sanders Ned 444-4444 ACCT-3433 2 T 10:00 AM
111-11-1111 Sanders Ned 444-4444 MGMT-3021 5 W 8:00 AM
111-11-1111 Sanders Ned 444-4444 ANSI-1422 7 F 9:00 AM
123-45-6789 Moore Artie 555-5555 ACCT-3433 2 T 10:00 AM
123-45-6789 Moore Artie 555-5555 FIN-3213 3 Th 11:00 AM
• What happens if you have a new student to add, but he hasn’t signed up for
any courses yet?
• Or what if there is a new class to add, but there are no students enrolled in it
yet? In either case, the record will be partially blank.
• This problem is referred to as an insert anomaly.
Last First
Student ID Name Name Phone No. Course No. Section Day Time
333-33-3333 Simpson Alice 333-3333 ACCT-3603 1 M 9:00 AM
333-33-3333 Simpson Alice 333-3333 FIN-3213 3 Th 11:00 AM
333-33-3333 Simpson Alice 333-3333 MGMT-3021 11 Th 12:00 PM
111-11-1111 Sanders Ned 444-4444 ACCT-3433 2 T 10:00 AM
111-11-1111 Sanders Ned 444-4444 MGMT-3021 5 W 8:00 AM
111-11-1111 Sanders Ned 444-4444 ANSI-1422 7 F 9:00 AM
123-45-6789 Moore Artie 555-5555 ACCT-3433 2 T 10:00 AM
123-45-6789 Moore Artie 555-5555 FIN-3213 3 Th 11:00 AM
• If Ned withdraws from all his classes and you eliminate all three of his rows from
the table, then you will no longer have a record of Ned. If Ned is planning to
take classes next semester, then you probably didn’t really want to delete all
records of him.
• This problem is referred to as a delete anomaly.
RELATIONAL DATABASES
Alternatives for storing data
Another possible approach would be to store each
student in one row of the table and create multiple
columns to accommodate each class that he is taking.
Last First Phone
Student ID Name Name No. Class 1 Class 2 Class 3 Class 4
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE • The solution to the preceding problems is to use
SCID a set of tables in a relational database.
333333333-1234 • Each entity is stored in a separate table, and
333333333-1236 separate tables or foreign keys can be used to
111111111-1235 link the entities together.
111111111-1236
PERSYARATAN DASAR DATABASE
RELASIONAL
1. Setiap kolom dalam baris harus dinilai tunggal
2. Kunci utama tidak bisa nol
3. Kunci asing, jika bukan nol, harus memiliki nilai
yang sesuai dengan nilai kunci utama
4. Semua atribut nonkunci dalam tabel harus
menjelaskan karakteristik objek yang diidentifikasi
berdasarkan kunci utama
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
SCID • Note that within each table, there are no
333333333-1234 duplicate primary keys and no null primary keys.
333333333-1236 • Consistent with the entity integrity rule.
111111111-1235
111111111-1236
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503
ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
• Add a course here.
SCID
• Leaves no blank spaces.
333333333-1234
333333333-1236
111111111-1235 • When a particular student enrolls for a
particular course, add that info here.
111111111-1236
STUDENTS
Last First Phone • Ned still
Student ID Name Name No. exists in the
333-33-3333 Simpson Alice 333-3333 student
111-11-1111 Sanders Ned 444-4444 table.
123-45-6789 Moore Artie 555-5555
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT x COURSE
• Even if Ned was the only student in the
SCID
class, ACCT-3603 still exists in the course
333333333-1234 table.
333333333-1236
111111111-1235 • If Ned Sanders drops ACCT-3603, remove
111111111-1236 Ned’s class from this table.
LATIHAN
Model data relasional menggambarkan data yang
disimpan dalam ...
a. Hierarki
b. Tabel
c. Objek
d. File
LATIHAN
Cara pengguna konseptual mengatur dan memahami
data disebut sebagai ...
a. Tampilan fisik
b. Tampilan logis
c. Tampilan model data
d. Tampilan organisasi data
LATIHAN
Manakah dibawah ini yang akan digunakan manajer
untuk mengambil informasi mengenai penjualan
selama bulan oktober ?
a. DML
b. DSL
DDL
c. DQL
LATIHAN
Manakah program perangkat lunak berikut ini yang
menjalankan sistem database ?
a. DQL
b. DBMS
c. DML
d. DDL
LATIHAN
Manakah di bawah ini yang merupakan tampilan
pengguna individu database ?
a. Skema level konseptual
b. Skema level eksternal
c. Skema level internal
d. Skema level logis
TUGAS KELOMPOK
Buatlah contoh database di Telkom University.
Tentukan database, file, entity, field, attributes dan
record.
TUGAS INDIVIDU
Beberapa orang percaya teknologi database dapat
mengeliminasi kebutuhan akuntansi pencatatan ganda
(double-entry accounting). Hal tersebut memunculkan tiga
kemungkinan :
1. Model pencatatan ganda akan ditinggalkan
2. Model pencatatan ganda tidak akan digunakan
secara langsung, tetapi skema level eksternal yang
berbasis pada model pencatatan ganda akan
ditentukan untuk penggunaan akuntan.
3. Model pencatatan ganda akan ada dalam sistem
database
Alternatif mana yang anda pikir akan paling mungkin
terjadi? Mengapa ?