Wednesday, April 14, 2021

.::: How to backup and restore table & database Oracle :::.


A. Backup & Restore table Oracle

1. Backup Table Database oracle 
exp aisyah/hanin@tka tables=pasok file="D:\labolatorium\oracle\backup\pasok.dmp"

2. Restore Table Oracle 
imp teguh/triharto@tka
imp teguh/triharto@tka tables=pasok file="D:\labolatorium\oracle\backup\pasok.dmp"

Thursday, April 8, 2021

.::: Sample Aljabar(Algebra) Iner join, normal join, equal join(=),left outer join and right outer join In SQL :::.:::.


1. join/normal join/equal join(=)

bertujuan untuk mencari kesamaan data antara table yang satu dengan table yang lain
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SELECT     table-1.field-1,...,table-1.field-n,
        table-2.field-1,...,table-2.field-n,
        table-n.field-1,...,table-n.field-n,
FROM     table-1,...,table-n
WHERE     table-1.field_PK = table-2.field_PK AND
        table-2.field_PK = table-n.field_PK

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Wednesday, April 7, 2021

.::: Sample Aljabar(Algebra): union(gabungan), intersection(irisan), MINUS (difference), distinct (proyeksi) In SQL :::.


1. UNION (Combine/gabungan)

union bertujuan menggabungkan dua query atau lebih menjadi satu kesatuan query dengan syarat query/subquery yang akan digabung harus memiliki domain kolom yang sama
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SELECT         field 1,...,field n,[agregate function]
FROM         table
 [WHERE]     [criteria]
 [GROUP BY] [field 1,...,field n]
UNION
SELECT         field 1,...,field n,[agregate function]
FROM         table
 [WHERE]     [kriteria]
 [GROUP BY] [field 1,...,field n]

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Tuesday, April 6, 2021

.::: Sample Query, Sub Query from one table or More in SQL :::.

1. select one table
select * from BARANG;
select * from SUPLIER;
select * from PASOK;


2. select more table
select BARANG.NAMA_BARANG, PASOK.TANGGAL_PASOK as TGL_PASOK,PASOK.JUMLAH_PASOK from BARANG, PASOK where BARANG.KODE_BARANG=PASOK.KODE_BARANG;
select BARANG.kode_BARANG,PASOK.kode_PASOK, BARANG.nama_BARANG,BARANG.satuan_BARANG, PASOK.tanggal_PASOK as tglPASOK, jumlah_PASOK from BARANG, PASOK where BARANG.kode_BARANG=PASOK.kode_BARANG;

.::: Sample min, max, avg, sum, count, Group by, order by, Having, where, comparison (=,<>,>,<,>= atau <=), Between, In, like / not like on Grouping, Sorting & Criteria Data SQL :::.


1. pengelompokan data (group by) dan aggregation function

select * from PASOK;
select KODE_BARANG as KD_BRG, min(JUMLAH_PASOK) as MINIMUM_PASOK from PASOK group by KODE_BARANG;
select KODE_BARANG as KD_BRG, max(JUMLAH_PASOK) as MAXIMUM_PASOK from PASOK group by KODE_BARANG;
select KODE_BARANG as KD_BRG, avg(JUMLAH_PASOK) as AVERAGE_PASOK from PASOK group by KODE_BARANG;
select KODE_BARANG as KD_BRG, sum(JUMLAH_PASOK) as JUMLAH_PASOK from PASOK  group by KODE_BARANG;
select KODE_BARANG as KD_BRG, count(JUMLAH_PASOK) as COUNT_PASOK from PASOK group by KODE_BARANG;

Popular Posts