Вы находитесь на странице: 1из 47

Pengantar Komputer

Program Studi Diploma III Kebendaharaan Negara


Semester I Tahun 2018

PKNSTAN – BPPK – Kementerian Keuangan ©2017 1


Microsoft Access
Tabel & Relasi

2
3
Mengenal Ms Access

• Ms Access  Relational DBMS yang dibuat oleh Microsoft


• Menggabungkan database engine (Access Jet Database Engine), antarmuka
database dan tools pengembangan aplikasi.
• Mendukung Visual Basic for Applications (VBA)
• File format ACCDB (Access 2007 earlier) and MDB (Access 2003 earlier)
formats
• Ms Access cocok digunakan untuk membuat aplikasi skala kecil, misal point of
sales (POS/kasir), & inventory.
4
Ms Access Limitation
• Max file database size ~ 2GB
• Max object in database = 32,768
• Max concurent access = 255
• Max table name length = 64 char
• Max field name length = 64 char
• Max field count in a table = 255

Reference: https://support.office.com/en-
us/article/Access-2016-specifications-0cf3c66f-
9cf2-4e32-9568-98c1025bb47c
5
Welcome Screen Ms Access
6
Create Database Baru
7
Create Database Baru
8
Create Table: Select Data Type
9
Data Type / Properties
Type of Data Description Size
Text or combinations of text and numbers, including numbers Up to 255 characters.
Short Text that do not require calculating (e.g. phone numbers).

Long Text Lengthy text or combinations of text and numbers. Up to 63, 999 characters.
Numeric data used in mathematical calculations. 1, 2, 4, or 8 bytes (16 bytes if
Number set to Replication ID).

Date/Time Date and time values for the years 100 through 9999. 8 bytes
Currency values and numeric data used in mathematical 8 bytes
Currency calculations involving data with one to four decimal places.

A unique sequential (incremented by 1) number or random 4 bytes (16 bytes if set to


AutoNumber number assigned by Microsoft Access whenever a new record Replication ID).
is added to a table.
Yes and No values and fields that contain only one of two 1 bit.
Yes/No
values (Yes/No, True/False, or On/Off).
10
Data Type (Cont)
Data Types Description Size
Files, such as digital photos. Multiple files can be attached per Up to about 2 GB.
Attachment record. This data type is not available in earlier versions of
Access.
OLE objects can store pictures, audio, video, or other BLOBs Up to about 2 GB.
OLE objects
(Binary Large Objects)
Text or combinations of text and numbers stored as text and Up to 8,192 (each part of a
Hyperlink used as a hyperlink address. Hyperlink data type can
contain up to 2048 characters).
A simple lookup field uses the contents of another table or a Dependent on the data type of
value list to validate the contents of a single value per row. A the lookup field.
Lookup Wizard complex lookup field allows you to store multiple values of the
same data type in each row.
You can create an expression
You can create an expression that uses data from one or more that uses data from one or
Calculated fields. You can designate different result data types from the more fields. You can designate
expression. different result data types
from the expression.
11
Create Table: Next To Other Field
12
Create Table: Save Table Name
13
Modify Structure Table
14
Import Data From File
15
Import Data From File
16
Import Data From File
17
Import Data From File
18
Import Data From File
19
Import Data From File
20
Import Data From File
21
Import Data From File
22
Latihan 1

1. Buatlah database baru dengan nama Penyewaan DVD Film


2. Dalam database tersebut buatlah tabel-tabel berikut ini:
Tabel 1 : Data Pelanggan
Nama Field Tipe Data Format
ID Pelanggan AutoNumber -
Nama Text -
Alamat Text -
Telepon Text -
Catatan Text -
23
Latihan 1 (lanjutan)
Tabel 2 : Data Film
Nama Field Tipe Data Format
ID Film AutoNumber -
Nama Film Text -
Kategori Text -
Stok Number -
Harga Sewa Currency -
Tahun Date/Time Yyyy
24
Latihan 1 (lanjutan)
Tabel 3 : Data Sewa
Nama Field Tipe Data Format
ID Film Number -
ID Pelanggan Number -
Qty Number -
Tgl Pinjam Date/Time Short Date
Tgl Kembali Date/Time Short Date
Status Kembali Yes/No -
25
Insert, Update, Delete Table Data

a) Menyisipkan Field
Sisipan field akan tampil di atas field yang dipilih. Untuk menyisipkan field,
Klik kanan pada salah satu field, pilih Insert Rows.

b) Menghapus Field
Untuk menghapus field, klik kanan pada field yang akan dihapus, lalu pilih
Delete Rows.

c) Menempatkan Data Berjenis Lookup Wizard


Tipe data Lookup Wizard adalah tipe data yang membuat sebuah lookup
column di mana datanya dapat diambil dari tabel, query, atau kita masukkan
sendiri sesuai keinginan.
26
Lookup Wizard 1
27
Lookup Wizard 2
28
Hasil Lookup Wizard
29
Sorting
30
Sorting (lanjutan)
31
Opsi Sorting
Tipe Data Opsi Sorting Keterangan
Text, Memo, Sort A to Z Melakukan sort alfabet
Hyperlink berdasarkan huruf-demi huruf
Sort Z to A (seperti di dalam kamus).
Pengurutan tidak bersifat case-
sensitive, artinya huruf besar
atau huruf kecil dianggap sama
saja.
Number, Sort Smallest to Largest Melakukan sort numerik,
Currency, meletakkan angka yang terkecil
AutoNumber Sort Largest to Smallest paling atas atau sebaliknya.
Date/Time Sort Oldest to Newest Melakukan sort berdasarkan
tanggal, membedakan antara tua
Sort Newest to Oldest (yang terjadi duluan) dengan
tanggal yang baru saja
berlangsung.
Yes/No Sort Selected to Cleared Memisahkan antara nilai yang
terpilih (Yes/Selected) dengan
Sort Cleared to Selected nilai yang tidak terpilih
(No/Unselected).
32
Quick Filter
33
Filter by Selection
34
Filter by Condition
35
Custom Filter
36
Clear All Filter
37
Primary Key
38
Primary Key (lanjutan)
39
40
Show Table di Relationship
41
Buat Relasi
Jenis relationships
• 1. One to One, yaitu satu record data pada suatu table dihubungkan hanya
dengan satu record data pada table lainnya.
• 2. One to Many, yaitu satu record data pada suatu table dihubungkan
dengan lebih dari satu record data pada table lainnya.
• 3. Many to Many, yaitu lebih dari satu record data pada suatu table
dihubungkan dengan lebih dari satu record data pada table lainnya.
• Kita tidak bisa menghubungkan field dengan data type text dengan field
dengan data type number, jadi harus memiliki data type yang sama
• Disarankan agar checkbox Enforce Referential Integrity selalu diberi tanda
Cheklist
relationships
 Enforce Referential Integrity, pilihan ini digunakan untuk memastikan bahwa
foreign key pada suatu table terdapat juga pada primary key didalam table
lainnya.
 Cascade Update Related Fields, pilihan ini digunakan untuk mengupdate
secara otomatis foreign key pada suatu table jika primary key didalam table
lainnya berubah. Pilihan ini akan aktif jika Enforce Referential Integrity telah
dipilih.
 Cascade Delete Related Record, pilihan ini digunakan untuk menghapus foreign
key pada suatu table jika primary key didalam table lainnya dihapus. Pilihan ini
akan aktif jika Enforce Referential Integrity telah dipilih.
45
Latihan 2
1. Buatlah database baru dengan nama Perpustakaan!
2. Dalam database tersebut buatlah tabel-tabel berikut ini:
Tabel 1 : Tb_Siswa
Nama Field Tipe Data Properties Keterangan
NIS AutoNumber - Diberi Primary Key
Nama Text 30 (Field Size) -
Tgl_Lahir Date/Time - -
Kelas Text 12 (Field Size) -
Alamat Text 50 (Field Size) -
Telepon Text 20 (Field Size) -
Ekskul Lookup Wizard - Pilihan Lookup
Wizard berupa = PMR,
Paskibra, Theater,
Pencinta Alam,
Olahraga
46
Latihan 2 (lanjutan)
Tabel 2 : Tb_Pinjam
Nama Field Tipe Data Properties
NIS Number -
Pinjaman Text 20 (Field Size)
Tgl_Pinjaman Date/Time -
Tgl_Kembali Date/Time -
Status Text 10 (Field Size)

1. Buatlah relasi dari NIS (tabel Data Siswa) ke NIS (tabel Data Pinjam)!
2. Tampilkan hasil relasinya!
Terima Kasih

47

Вам также может понравиться