1 create view View_Buku(Kd,Jdl,Pgr,Pnb,Hrg,Jml)
as
select Kode, Judul, Pengarang, Penerbit, Harga, Jumlah
from buku
2 Select Kd [KODE BUKU], Jdl [JUDUL BUKU], Pgr [PENGARANG], Pnb [PENERBIT], Hrg [HARGA BELI], Jml [JUMLAH BUKU]
from View_Buku
3 Insert into View_Buku
Values('44444','Membelah Pusaran Air','Susianah','Biru Langit',25000,12)
4 Update View_Buku
set Hrg = Hrg + ((Hrg * 100)/1000
where Kd = '44444'
5 Create View Insert-Jual
as select * from Jual
Insert into Insert_Jual
values('0000001','03/14/2005','44444',40000,1)
6 Create View V_Lihat_Jaul
as
Select Tgl_Jual, Judul, Hrg_Jual, Jml_Jual,(Hrg_jual * Jml_Jual) [TOTAL HARGA]
from Buku B inner join Jual J
on B.Kode = J.Kd_Buku
where Tgl_Jual = '03/14/2005'
7 Create View V_Total_Beli
as
Select Kd_Dis, count (*) [Jumlah Data],
sum (Hrg_Beli * Jml_Beli) [Total Pembelian]
8 Create View View_Jual
as
Select * from Jual
go
insert into View_Jual
values('0000002','03/25/2005','22222',47500,1)
insert into View_Jual
values('0000003','03/27/2005','22222',47500,5)
insert into View_Jual
values('0000004','03/27/2005','22222',47500,3)
9 Create View View_Rata_Jual
as
Select *
from Jual
where Jml_Jual >= (select avg (Jml_Jual)
from Jual Where Kd_Buku = '22222')
Tidak ada komentar:
Posting Komentar