0% found this document useful (0 votes)
34 views

XAMPP

The document contains the code and output of a MariaDB database query. The query selects and displays information from various tables in the pembelian database related to purchases and suppliers. Specifically, it shows: [1] the most expensive item, [2] all purchase transactions with supplier names, [3] the supplier with the largest purchase quantity, [4] the item most frequently purchased, and [5] a join of multiple tables to show all data related to purchases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

XAMPP

The document contains the code and output of a MariaDB database query. The query selects and displays information from various tables in the pembelian database related to purchases and suppliers. Specifically, it shows: [1] the most expensive item, [2] all purchase transactions with supplier names, [3] the supplier with the largest purchase quantity, [4] the item most frequently purchased, and [5] a join of multiple tables to show all data related to purchases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy