Praktek Pemrograman SQL
selasa, 04 April 2017
use "076"
create table pembelian(
nonota varchar(10) primary key,
kdbrg varchar(10),
kdsup varchar(10),
tanggalbeli date,
jumlahbeli int,
hargabeli int,
total int,
foreign key (kdbrg) references BARANG (kdbrg),
foreign key (kdsup) references Supplier (kdsup)
)
nonota varchar(10) primary key,
kdbrg varchar(10),
kdsup varchar(10),
tanggalbeli date,
jumlahbeli int,
hargabeli int,
total int,
foreign key (kdbrg) references BARANG (kdbrg),
foreign key (kdsup) references Supplier (kdsup)
)
insert into pembelian
values ('HG001','001','Sup001','2017/12/07',200,2000,400000)
values ('HG001','001','Sup001','2017/12/07',200,2000,400000)
insert into pembelian
values ('HG002','002','Sup002','2020/01/20',150,3000,450000)
insert into pembelian
values ('HG003','003','Sup003','2019/05/07',300,400,1200000)
insert into pembelian
values ('HG004','004','Sup004','2019/01/01',100,4500,450000)
insert into pembelian
values ('HG005','005','Sup005','2018/12/12',350,2000,700000)
insert into pembelian
values ('HG006','006','Sup006','2018/11/05',50,5500,275000)
insert into pembelian
values ('HG007','007','Sup007','2021/03/25',100,7000,700000)
insert into pembelian
values ('HG008','008','Sup008','2018/01/23',80,15000,1200000)
insert into pembelian
values ('HG009','009','Sup009','2020/05/07',125,10000,1250000)
insert into pembelian
values ('HG010','010','Sup010','2022/01/01',90,15500,1395000)
select * from pembelian
Maka akan terbentuk sebuah relasi
0 comments:
Post a Comment