XAMPP

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Aisiyah Ainunnisa

202153059
Kelas D

Laporan Praktikum
Pertemuan Ke-6

Kode Pemograman :
MariaDB [(none)]> use pembelian;
Database changed
MariaDB [pembelian]> # 1. Tampilkan nama barang dan harganya paling mahal
MariaDB [pembelian]> select * from barang;
+-----------+---------------------+-------+-------------+---------+
| ID_Barang | Nama_Barang | Harga | Jumlah_Stok | ID_Toko |
+-----------+---------------------+-------+-------------+---------+
| A001 | Kotak Pengsil | 40000 | 20 | T1 |
| A002 | Kotak Kado | 20000 | 10 | T1 |
| A003 | Meja Lipat Kayu | 30000 | 10 | T1 |
| A004 | Meja Lipat Pelastik | 20000 | 15 | T1 |
| B001 | Penghapus | 2000 | 50 | T2 |
| B0010 | Kertas Pelangi | 6000 | 100 | T3 |
| B002 | Pengsil | 1000 | 20 | T2 |
| B003 | Rautan | 1000 | 20 | T2 |
| B004 | Penggaris | 5000 | 40 | T2 |
| B005 | Pulpen | 3000 | 80 | T2 |
| B006 | Sepidol | 3000 | 80 | T2 |
| B007 | Kertas Volio | 500 | 100 | T3 |
| B008 | Kertas HVS | 200 | 100 | T3 |
| B009 | Kertas Manila | 6000 | 100 | T3 |
+-----------+---------------------+-------+-------------+---------+
14 rows in set (0.001 sec)

MariaDB [pembelian]> select Nama_Barang, Harga from Barang where Harga=(select


Max(Harga) from Barang);
+---------------+-------+
| Nama_Barang | Harga |
+---------------+-------+
| Kotak Pengsil | 40000 |
+---------------+-------+
1 row in set (0.020 sec)
MariaDB [pembelian]> # 2. Tampilkan seluruh transaksi pembelian beserta nama
Supplier
MariaDB [pembelian]> select nota.*,supplier.Nama_supplier from nota join supplier
on(nota.ID_Supplier=supplier.ID_Supplier);
+-------------+-------------+------------+-------------+---------+------------+---
------------+
| ID_Supplier | ID_Nota | Tanggal | Total_Bayar | ID_Toko | ID_pegawai |
Nama_supplier |
+-------------+-------------+------------+-------------+---------+------------+---
------------+
| S001 | 202153059-1 | 2023-03-29 | 0 | T1 | P001 |
Setia Ningsih |
| S002 | 202153059-2 | 2023-03-29 | 0 | T1 | P001 |
Novita Sari |
| S003 | 202153059-3 | 2023-03-29 | 0 | T1 | P001 |
Raditiya Dika |
| S004 | 202153059-4 | 2023-03-29 | 0 | T1 | P001 |
Rafi Ahmad |
| S005 | 202153059-5 | 2023-03-29 | 0 | T1 | P001 |
Eva Maharani |
+-------------+-------------+------------+-------------+---------+------------+---
------------+
5 rows in set (0.011 sec)

MariaDB [pembelian]> # 3. Tampilkan Nama supplier dengan kuentity pembelian


terbanyak
MariaDB [pembelian]> select supplier.Nama_supplier, order_beli.Qty from supplier
join Nota on(nota.ID_supplier=Supplier.ID_Supplier) join order_beli
on(nota.ID_nota=Order_beli.ID_nota) where order_beli.QTY=(select Max(qty)from
order_beli);
+---------------+------+
| Nama_supplier | Qty |
+---------------+------+
| Rafi Ahmad | 14 |
+---------------+------+
1 row in set (0.014 sec)

MariaDB [pembelian]> # 4. Tampilkan nama barang yang paling sering terjadi


pembelian
MariaDB [pembelian]> select order_beli.*,count(order_beli.ID_Barang) AS frek,
Barang.Nama_barang from order_beli join barang
on(order_beli.ID_barang=Barang.ID_barang) group by order_beli.ID_Barang order by
frek desc limit 1;
+----+-------------+-----------+------+------+-------------+
| ID | ID_Nota | ID_Barang | Qty | frek | Nama_barang |
+----+-------------+-----------+------+------+-------------+
| 1 | 202153059-1 | B001 | 8 | 3 | Penghapus |
+----+-------------+-----------+------+------+-------------+
1 row in set (0.009 sec)
MariaDB [pembelian]> # 5.
MariaDB [pembelian]> select nota.*,order_beli.qty, barang.Nama_barang,
supplier.Nama_supplier from nota join supplier
on(nota.ID_supplier=supplier.ID_supplier) join Order_beli
on(nota.ID_nota=order_beli.ID_Nota) join barang
on(order_beli.ID_barang=Barang.ID_barang);
+-------------+-------------+------------+-------------+---------+------------+---
---+---------------+---------------+
| ID_Supplier | ID_Nota | Tanggal | Total_Bayar | ID_Toko | ID_pegawai |
qty | Nama_barang | Nama_supplier |
+-------------+-------------+------------+-------------+---------+------------+---
---+---------------+---------------+
| S001 | 202153059-1 | 2023-03-29 | 0 | T1 | P001 |
8 | Penghapus | Setia Ningsih |
| S001 | 202153059-1 | 2023-03-29 | 0 | T1 | P001 |
10 | Pengsil | Setia Ningsih |
| S002 | 202153059-2 | 2023-03-29 | 0 | T1 | P001 |
9 | Rautan | Novita Sari |
| S002 | 202153059-2 | 2023-03-29 | 0 | T1 | P001 |
4 | Penggaris | Novita Sari |
| S002 | 202153059-2 | 2023-03-29 | 0 | T1 | P001 |
6 | Pulpen | Novita Sari |
| S003 | 202153059-3 | 2023-03-29 | 0 | T1 | P001 |
7 | Penghapus | Raditiya Dika |
| S004 | 202153059-4 | 2023-03-29 | 0 | T1 | P001 |
12 | Penghapus | Rafi Ahmad |
| S004 | 202153059-4 | 2023-03-29 | 0 | T1 | P001 |
14 | Kertas Manila | Rafi Ahmad |
| S005 | 202153059-5 | 2023-03-29 | 0 | T1 | P001 |
5 | Sepidol | Eva Maharani |
| S005 | 202153059-5 | 2023-03-29 | 0 | T1 | P001 |
3 | Kertas Volio | Eva Maharani |
+-------------+-------------+------------+-------------+---------+------------+---
---+---------------+---------------+
10 rows in set (0.002 sec)
Hasil Tangkap layar
Bagian 1
Oprasi Untuk menampilkan :
1. Menampilkan nama barang dan harganya paling mahal

2. Tampilkan seluruh transaksi pembelian beserta nama Supplier


3. Tampilkan Nama supplier dengan kuentity pembelian terbanyak

4. Tampilkan nama barang yang paling sering terjadi pembelian

5. Tampilkan semua

You might also like