Saturday, 25 June 2011


create table kamar(tipekamar text (10) not null primary key,nmkamar text (15),harga currency);
insert into kamar values("deluxe","anggrek","120000");
insert into kamar values("vip","melati","100000");



create table karyawan(nok text(4) not null primary key,nama text (10) ,alamat text (15),shift text (5));
insert into karyawan values("101","asep","bogor","pagi");
insert into karyawan values("102","udin","bandung","malam");

create table billroom(billnumber text (10) ,tanggal date,tipekamar text (10),nok text (4),bnykkamar number);
insert into billroom values("ab01","09/04/2011","deluxe","101","1");
insert into billroom values("ab02","10/04/2011","vip","102","1");


2 table

SELECT billroom.billnumber, billroom.tanggal, billroom.tipekamar, billroom.nok, billroom.bnykkamar, kamar.tipekamar, kamar.nmkamar, kamar.harga, [bnykkamar]*[harga] AS subtotal, IIf([bnykkamar]>2,[subtotal]*10/100,0) AS diskon, [subtotal]-[diskon] AS total
FROM kamar INNER JOIN billroom ON kamar.tipekamar=billroom.tipekamar;



3 table

SELECT billroom.billnumber, billroom.tanggal, karyawan.nama, billroom.tipekamar, billroom.nok, billroom.bnykkamar, kamar.tipekamar, kamar.nmkamar, kamar.harga, [bnykkamar]*[harga] AS subtotal, IIf([bnykkamar]>2,[subtotal]*10/100,0) AS diskon, [subtotal]-[diskon] AS total
FROM (kamar INNER JOIN billroom ON kamar.tipekamar=billroom.tipekamar) INNER JOIN karyawan ON karyawan.nok=billroom.nok;
Categories:

0 comments:

Post a Comment

Subscribe to RSS Feed Follow me on Twitter!