You are on page 1of 12

TUGAS II BASIS DATA LANJUT

Rancang Bangun Sistem Informasi Penggajian

Disusun oleh:

1. Nieko W. (0834015002)
2. Alfiyan (0834015014)
3. Husnatut Dianah (0834015047)

Dosen Pengampu :
Syurfah Ayu, S.Kom

TEKNIK INFORMATIKA - FAKULTAS TEKNOLOGI INDUSTRI


UPN ‘VETERAN’ JAWA TIMUR
2010
1. Entity Relationship Diagram
2. Conceptual Data Model
3. Physical Data Model
4. Script hasil generate dari PDM

/*==============================================================*/
/* DBMS name: Sybase AS Anywhere 9 */
/* Created on: 3/24/2011 5:44:43 AM */
/*==============================================================*/

if exists(select 1 from sys.sysforeignkey where role='FK_MASA_KER_BERPENGAR_GAJI') then


alter table MASA_KERJA
delete foreign key FK_MASA_KER_BERPENGAR_GAJI
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_PEGAWAI_BEKERJA_S_MASA_KER') then


alter table PEGAWAI
delete foreign key FK_PEGAWAI_BEKERJA_S_MASA_KER
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_PEGAWAI_MEMILIKI_GAJI') then


alter table PEGAWAI
delete foreign key FK_PEGAWAI_MEMILIKI_GAJI
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_PEGAWAI_MENEMPATI_POSISI') then


alter table PEGAWAI
delete foreign key FK_PEGAWAI_MENEMPATI_POSISI
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_POSISI_MENENTUKA_GAJI') then


alter table POSISI
delete foreign key FK_POSISI_MENENTUKA_GAJI
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_PRESTASI_BERPRESTA_PEGAWAI') then


alter table PRESTASI
delete foreign key FK_PRESTASI_BERPRESTA_PEGAWAI
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_PEGAWAI_MEMPUNYAI_PRESTASI') then


alter table PRESTASI
delete foreign key FK_PEGAWAI_MEMPUNYAI_PRESTASI
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_PRESTASI_MENAMBAH_GAJI') then


alter table PRESTASI
delete foreign key FK_PRESTASI_MENAMBAH_GAJI
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_PRESTASI_RELATIONS_PRESTASI') then


alter table PRESTASI
delete foreign key FK_PRESTASI_RELATIONS_PRESTASI
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='GAJI_PK'
and t.table_name='GAJI'
) then
drop index GAJI.GAJI_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='BERPENGARUH_PADA_FK'
and t.table_name='MASA_KERJA'
) then
drop index MASA_KERJA.BERPENGARUH_PADA_FK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='MASA_KERJA_PK'
and t.table_name='MASA_KERJA'
) then
drop index MASA_KERJA.MASA_KERJA_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='BEKERJA_SELAMA_FK'
and t.table_name='PEGAWAI'
) then
drop index PEGAWAI.BEKERJA_SELAMA_FK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='MEMILIKI_FK'
and t.table_name='PEGAWAI'
) then
drop index PEGAWAI.MEMILIKI_FK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='MENEMPATI_FK'
and t.table_name='PEGAWAI'
) then
drop index PEGAWAI.MENEMPATI_FK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='PEGAWAI_PK'
and t.table_name='PEGAWAI'
) then
drop index PEGAWAI.PEGAWAI_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='MENENTUKAN_FK'
and t.table_name='POSISI'
) then
drop index POSISI.MENENTUKAN_FK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='POSISI_PK'
and t.table_name='POSISI'
) then
drop index POSISI.POSISI_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='BERPRESTASI_FK'
and t.table_name='PRESTASI'
) then
drop index PRESTASI.BERPRESTASI_FK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='MEMPUNYAI_FK'
and t.table_name='PRESTASI'
) then
drop index PRESTASI.MEMPUNYAI_FK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='MENAMBAH_FK'
and t.table_name='PRESTASI'
) then
drop index PRESTASI.MENAMBAH_FK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='PRESTASI_PK'
and t.table_name='PRESTASI'
) then
drop index PRESTASI.PRESTASI_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='RELATIONSHIP_7_FK'
and t.table_name='PRESTASI'
) then
drop index PRESTASI.RELATIONSHIP_7_FK
end if;

if exists(
select 1 from sys.systable
where table_name='GAJI'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table GAJI
end if;

if exists(
select 1 from sys.systable
where table_name='MASA_KERJA'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table MASA_KERJA
end if;

if exists(
select 1 from sys.systable
where table_name='PEGAWAI'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table PEGAWAI
end if;

if exists(
select 1 from sys.systable
where table_name='POSISI'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table POSISI
end if;

if exists(
select 1 from sys.systable
where table_name='PRESTASI'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table PRESTASI
end if;

/*==============================================================*/
/* Table: GAJI */
/*==============================================================*/
create table GAJI
(
ID_GAJI varchar(12) not null,
GAJI_POKOK integer not null,
BONUS integer,
constraint PK_GAJI primary key (ID_GAJI)
);

/*==============================================================*/
/* Index: GAJI_PK */
/*==============================================================*/
create unique index GAJI_PK on GAJI (
ID_GAJI ASC
);

/*==============================================================*/
/* Table: MASA_KERJA */
/*==============================================================*/
create table MASA_KERJA
(
ID_MASA_KERJA varchar(12) not null,
ID_GAJI varchar(12) not null,
TGL_MASUK date,
JAM_KERJA integer not null,
LEMBUR integer not null,
TELAT integer,
ABSEN integer not null,
constraint PK_MASA_KERJA primary key (ID_MASA_KERJA)
);

/*==============================================================*/
/* Index: MASA_KERJA_PK */
/*==============================================================*/
create unique index MASA_KERJA_PK on MASA_KERJA (
ID_MASA_KERJA ASC
);

/*==============================================================*/
/* Index: BERPENGARUH_PADA_FK */
/*==============================================================*/
create index BERPENGARUH_PADA_FK on MASA_KERJA (
ID_GAJI ASC
);

/*==============================================================*/
/* Table: PEGAWAI */
/*==============================================================*/
create table PEGAWAI
(
NIP varchar(12) not null,
ID_POSISI varchar(12) not null,
ID_GAJI varchar(12) not null,
ID_MASA_KERJA varchar(12) not null,
NM_DPN long varchar,
NM_BLKG long varchar not null,
GENDER smallint,
TMPT_LHR long varchar,
TGL_LHR date,
ALAMAT varchar(30),
EMAIL varchar(20) not null,
TELP numeric(12),
constraint PK_PEGAWAI primary key (NIP)
);

/*==============================================================*/
/* Index: PEGAWAI_PK */
/*==============================================================*/
create unique index PEGAWAI_PK on PEGAWAI (
NIP ASC
);

/*==============================================================*/
/* Index: MENEMPATI_FK */
/*==============================================================*/
create index MENEMPATI_FK on PEGAWAI (
ID_POSISI ASC
);

/*==============================================================*/
/* Index: BEKERJA_SELAMA_FK */
/*==============================================================*/
create index BEKERJA_SELAMA_FK on PEGAWAI (
ID_MASA_KERJA ASC
);

/*==============================================================*/
/* Index: MEMILIKI_FK */
/*==============================================================*/
create index MEMILIKI_FK on PEGAWAI (
ID_GAJI ASC
);

/*==============================================================*/
/* Table: POSISI */
/*==============================================================*/
create table POSISI
(
ID_POSISI varchar(12) not null,
ID_GAJI varchar(12) not null,
NAMA_POSISI varchar(20),
constraint PK_POSISI primary key (ID_POSISI)
);

/*==============================================================*/
/* Index: POSISI_PK */
/*==============================================================*/
create unique index POSISI_PK on POSISI (
ID_POSISI ASC
);

/*==============================================================*/
/* Index: MENENTUKAN_FK */
/*==============================================================*/
create index MENENTUKAN_FK on POSISI (
ID_GAJI ASC
);

/*==============================================================*/
/* Table: PRESTASI */
/*==============================================================*/
create table PRESTASI
(
ID_PRESTASI varchar(12) not null,
PRE_ID_PRESTASI varchar(12),
NIP varchar(12) not null,
ID_GAJI varchar(12) not null,
PEG_NIP varchar(12) not null,
PRESTASI long varchar,
TGL_PRESTASI date,
BIDANG long varchar,
constraint PK_PRESTASI primary key (ID_PRESTASI)
);

/*==============================================================*/
/* Index: PRESTASI_PK */
/*==============================================================*/
create unique index PRESTASI_PK on PRESTASI (
ID_PRESTASI ASC
);

/*==============================================================*/
/* Index: BERPRESTASI_FK */
/*==============================================================*/
create index BERPRESTASI_FK on PRESTASI (
NIP ASC
);

/*==============================================================*/
/* Index: RELATIONSHIP_7_FK */
/*==============================================================*/
create index RELATIONSHIP_7_FK on PRESTASI (
PRE_ID_PRESTASI ASC
);

/*==============================================================*/
/* Index: MENAMBAH_FK */
/*==============================================================*/
create index MENAMBAH_FK on PRESTASI (
ID_GAJI ASC
);

/*==============================================================*/
/* Index: MEMPUNYAI_FK */
/*==============================================================*/
create index MEMPUNYAI_FK on PRESTASI (
PEG_NIP ASC
);

alter table MASA_KERJA


add constraint FK_MASA_KER_BERPENGAR_GAJI foreign key (ID_GAJI)
references GAJI (ID_GAJI)
on update restrict
on delete restrict;

alter table PEGAWAI


add constraint FK_PEGAWAI_BEKERJA_S_MASA_KER foreign key (ID_MASA_KERJA)
references MASA_KERJA (ID_MASA_KERJA)
on update restrict
on delete restrict;

alter table PEGAWAI


add constraint FK_PEGAWAI_MEMILIKI_GAJI foreign key (ID_GAJI)
references GAJI (ID_GAJI)
on update restrict
on delete restrict;

alter table PEGAWAI


add constraint FK_PEGAWAI_MENEMPATI_POSISI foreign key (ID_POSISI)
references POSISI (ID_POSISI)
on update restrict
on delete restrict;

alter table POSISI


add constraint FK_POSISI_MENENTUKA_GAJI foreign key (ID_GAJI)
references GAJI (ID_GAJI)
on update restrict
on delete restrict;

alter table PRESTASI


add constraint FK_PRESTASI_BERPRESTA_PEGAWAI foreign key (NIP)
references PEGAWAI (NIP)
on update restrict
on delete restrict;

alter table PRESTASI


add constraint FK_PEGAWAI_MEMPUNYAI_PRESTASI foreign key (PEG_NIP)
references PEGAWAI (NIP)
on update restrict
on delete restrict;

alter table PRESTASI


add constraint FK_PRESTASI_MENAMBAH_GAJI foreign key (ID_GAJI)
references GAJI (ID_GAJI)
on update restrict
on delete restrict;

alter table PRESTASI


add constraint FK_PRESTASI_RELATIONS_PRESTASI foreign key (PRE_ID_PRESTASI)
references PRESTASI (ID_PRESTASI)
on update restrict
on delete restrict;

You might also like