/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 3/11/2018 10:15:33 PM */
/*==============================================================*/
drop table if exists BAJU;
drop table if exists DIKELOLA;
drop table if exists KASIR;
drop table if exists MEMILIKI;
drop table if exists PEMBELI;
drop table if exists PENJAGA;
/*==============================================================*/
/* Table: BAJU */
/*==============================================================*/
create table BAJU
(
KODE_BAJU varchar(20) not null,
BRND_BAJU varchar(50),
HARGA_BAJU numeric(8,0),
JUMLAH_STOCK numeric(8,0),
primary key (KODE_BAJU)
);
/*==============================================================*/
/* Table: DIKELOLA */
/*==============================================================*/
create table DIKELOLA
(
KODE_BAJU varchar(20) not null,
ID_PENJAGA varchar(5) not null,
primary key (KODE_BAJU, ID_PENJAGA)
);
/*==============================================================*/
/* Table: KASIR */
/*==============================================================*/
create table KASIR
(
ID_KASIR int not null,
ID_PEMBELI int not null,
NAMA_KASIR varchar(50),
NO_TLP_KASIR numeric(8,0),
primary key (ID_KASIR)
);
/*==============================================================*/
/* Table: MEMILIKI */
/*==============================================================*/
create table MEMILIKI
(
ID_PEMBELI int not null,
KODE_BAJU varchar(20) not null,
primary key (ID_PEMBELI, KODE_BAJU)
);
/*==============================================================*/
/* Table: PEMBELI */
/*==============================================================*/
create table PEMBELI
(
ID_PEMBELI int not null,
NAMA_PEMBELI varchar(50),
ALAMAT_PEMBELI varchar(100),
NO_TLP_PEMBELI numeric(8,0),
primary key (ID_PEMBELI)
);
/*==============================================================*/
/* Table: PENJAGA */
/*==============================================================*/
create table PENJAGA
(
ID_PENJAGA varchar(5) not null,
NAMA_PENJAGA varchar(50),
ALAMAT_PENJAGA varchar(100),
NO_TLP_PENJAGA numeric(8,0),
primary key (ID_PENJAGA)
);
alter table DIKELOLA add constraint FK_DIKELOLA foreign key (KODE_BAJU)
references BAJU (KODE_BAJU) on delete restrict on update restrict;
alter table DIKELOLA add constraint FK_DIKELOLA2 foreign key (ID_PENJAGA)
references PENJAGA (ID_PENJAGA) on delete restrict on update restrict;
alter table KASIR add constraint FK_BAYAR foreign key (ID_PEMBELI)
references PEMBELI (ID_PEMBELI) on delete restrict on update restrict;
alter table MEMILIKI add constraint FK_MEMILIKI foreign key (ID_PEMBELI)
references PEMBELI (ID_PEMBELI) on delete restrict on update restrict;
alter table MEMILIKI add constraint FK_MEMILIKI2 foreign key (KODE_BAJU)
references BAJU (KODE_BAJU) on delete restrict on update restrict;
Translate
Langganan:
Posting Komentar (Atom)
Linktree dan Lynk Id
π¨ Yuk eksplor portofolio seni & desain saya! Asrawan Arts Group – Art, Design, Abstract, Illustration & Digital Product π Linktre...
-
PROJECT 3 MODUL 3 Manipulasi Data. PROJECT 3 MODUL 3 Manipulasi Data. 4..) Kesimpulan yang saya dapat dari nomer 2 dan 3 adalah ...
-
[Bahasa Indonesia] Hai semuanya! Kamu sedang mencari desain kreatif, seni digital, atau ingin melihat berbagai karya dan project keren yang...
Tidak ada komentar:
Posting Komentar