LAPORAN
Basis Data
Oleh :
PURWOKERTO
2015
EVALUASI DAN PERTANYAAN
Setelah tampil layar putih, maka pilih icon entity untuk membuat entitas entitas.
Pembuatan tabel karyawan
Attribute dari tabel karyawan, pada field kode_karyawan diberi primary key dan
mandatory.
Pembuatan tabel gaji.
Attribute dari tabel gaji, pada field kode_gaji diberi primary key dan mandatory.
Pembuatan tabel transaksi.
Atrribute dari tabel transaksi, pada field kode_transaksi diberi primary key dan
mandatory.
Pembuatan tabel jabatan.
Attribute dari tabel jabatan, pada field kode_jabatan diberi primary key dan
mandatory.
Pembuatan tabel item_penjualan
Attribute dari tabel ,ember,pada field kode_member diberi primary dan mandatory.
Pembuatan tabel menu.
Attribute dari tabel menu, pada kode_menu diberi primary key dan mandatory.
Relationship
Pada tab detail tambahkan tbl_ pada table prefix, kemudian rubah update rule dan
delete rule menjadi cascade. Gunanya agar bisa dilakukan delete maupun update
pada tiap relasinya.
Setelah di apply dan ok, maka akan tampil seperti gambar dibawah ini.
Generate Database
Pilih database kemudian klick generate database.
Pada DBMS rubah ke mysql 5.0 karena kami menggunakan database mysql versi 5.
Query Database
/*===========================================================
===*/
/* DBMS name: MySQL 5.0 */
/* Created on: 22/12/2015 11:50:11 */
/*===========================================================
===*/
drop table if exists TBL_GAJI;
drop table if exists TBL_ITEM_PENJUALAN;
drop table if exists TBL_JABATAN;
drop table if exists TBL_KARYAWAN;
drop table if exists TBL_MEMBER;
drop table if exists TBL_MENU;
drop table if exists TBL_TRANSAKSI;
/*===========================================================
===*/
/* Table: TBL_GAJI */
/*===========================================================
===*/
create table TBL_GAJI
(
KODE_GAJI int not null,
KODE_KARYAWAN int not null,
GAJI int,
primary key (KODE_GAJI)
);
/*===========================================================
===*/
/* Table: TBL_ITEM_PENJUALAN */
/*===========================================================
===*/
create table TBL_ITEM_PENJUALAN
(
ID_PENJUALAN int not null,
KODE_TRANSAKSI int not null,
KODE_MENU int not null,
HARGA_PER_ITEM int,
KUANTITAS_PER_ITEM int,
JUMLAH_HARGA_PER_ITEM int,
primary key (ID_PENJUALAN)
);
/*===========================================================
===*/
/* Table: TBL_JABATAN */
/*===========================================================
===*/
create table TBL_JABATAN
(
KODE_JABAATAN int not null,
NAMA_JABATAN text,
primary key (KODE_JABAATAN)
);
/*===========================================================
===*/
/* Table: TBL_KARYAWAN */
/*===========================================================
===*/
create table TBL_KARYAWAN
(
KODE_KARYAWAN int not null,
KODE_JABAATAN int not null,
KODE_GAJI int,
NAMA_KARYAWAN text,
ALAMAT_KARYAWAN text,
TANGGAL_LAHIR_KARYAWAN date,
NOMOR_HP_KARYAWAN numeric(8,0),
JENIS_KELAMIN_KARYAWAN text,
primary key (KODE_KARYAWAN)
);
/*===========================================================
===*/
/* Table: TBL_MEMBER */
/*===========================================================
===*/
create table TBL_MEMBER
(
KODE_MEMBER int not null,
NAMA_MEMBER text,
EMAIL_MEMBER text,
NO_HP_MEMBER numeric(8,0),
ALAMAT_MEMBER text,
TGL_LAHIR_MEMBER date,
JENIS_KELAMIN_MEMBER text,
primary key (KODE_MEMBER)
);
/*===========================================================
===*/
/* Table: TBL_MENU */
/*===========================================================
===*/
create table TBL_MENU
(
KODE_MENU int not null,
NAMA_MENU text,
HARGA_MENU int,
DESKRIPSI_MEU text,
primary key (KODE_MENU)
);
/*===========================================================
===*/
/* Table: TBL_TRANSAKSI */
/*===========================================================
===*/
create table TBL_TRANSAKSI
(
KODE_TRANSAKSI int not null,
KODE_KARYAWAN int not null,
KODE_MEMBER int not null,
TANGGAL_TRANSAKSI date,
DISKON float,
TOTAL_HARGA_SELURUHNYA float,
primary key (KODE_TRANSAKSI)
);
alter table TBL_GAJI add constraint FK_MEMILIKI foreign key
(KODE_KARYAWAN) references TBL_KARYAWAN (KODE_KARYAWAN) on
delete cascade on update cascade;
alter table TBL_ITEM_PENJUALAN add constraint FK_MENGAMBIL foreign key
(KODE_MENU) references TBL_MENU (KODE_MENU) on delete cascade on
update cascade;
alter table TBL_ITEM_PENJUALAN add constraint FK_MENGHITUNG foreign
key (KODE_TRANSAKSI) references TBL_TRANSAKSI (KODE_TRANSAKSI)
on delete cascade on update cascade;
alter table TBL_KARYAWAN add constraint FK_MEMILIKI2 foreign key
(KODE_GAJI) references TBL_GAJI (KODE_GAJI) on delete cascade on update
cascade;
alter table TBL_KARYAWAN add constraint FK_MEMPUNYAI foreign key
(KODE_JABAATAN) references TBL_JABATAN (KODE_JABAATAN) on delete
cascade on update cascade;
alter table TBL_TRANSAKSI add constraint FK_MELAKUKAN foreign key
(KODE_MEMBER) references TBL_MEMBER (KODE_MEMBER) on delete
cascade on update cascade;
alter table TBL_TRANSAKSI add constraint FK_MELAYANI foreign key
(KODE_KARYAWAN) references TBL_KARYAWAN (KODE_KARYAWAN) on
delete cascade on update cascade;
Import Database
Buka phpmyadmin, dan buat database toko.
Pilih tab import, pada choose file pilih file toko.sql kemudian klick go.
Berikut adalah hasil setelah diimport pada database toko menggunakan DBMS
MySql versi 5.