PERINTAH QUERY INNER JOIN TABEL BARANG DI DATABASE_PENJUALAN
PERINTAH QUERY INNER JOIN DI DATABASE_PENJUALAN
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\EDI SANTOSO>cd/xampp/mysql/bin
C:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.8 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use database_penjualan;
Database changed
mysql> show tables;
+------------------------------+
| Tables_in_database_penjualan |
+------------------------------+
| barang |
| customer |
| detail_transaksi |
| jenis |
| lokasi |
| petugas |
| satuan |
| supplier |
| transaksi |
+------------------------------+
9 rows in set (0.02 sec)
mysql> select * from barang;
+-------------+----------------+---------------+------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | kode_supplier | kode_jenis | stock | kode_satuan | kode_lokasi | harga |
+-------------+----------------+---------------+------------+-------+-------------+-------------+-------+
| br01 | rinso | sp01 | 1 | 200 | s01 | l01 | 2000 |
| br02 | lifeboy | sp02 | 2 | 300 | s02 | l02 | 3000 |
| br03 | sampoerna mild | sp03 | 3 | 700 | s03 | l03 | 15000 |
| br04 | tropical | sp04 | 4 | 500 | s04 | l04 | 20000 |
| br05 | clear | sp05 | 5 | 400 | s05 | l05 | 2000 |
+-------------+----------------+---------------+------------+-------+-------------+-------------+-------+
5 rows in set (0.02 sec)
mysql> select* from supplier;
+---------------+----------------------+-----------+-----------------------+--------------+
| kode_supplier | nama_supplier | alamat | email | no_telp |
+---------------+----------------------+-----------+-----------------------+--------------+
| sp01 | pt.deterjen nusantar | jakarta | deterjen.01@yahoo.com | 021777xxxxxx |
| sp02 | pt.lifeboy global | jakarta | lifeboy.02@yahoo.com | 021232xxxxxx |
| sp03 | pt.djarum indonesia | banten | djarum.03@gmail.com | 021999xxxxxx |
| sp04 | pt.bimoli nusantara | jakarta | bimoli.04@gmail.com | 021222xxxxxx |
| sp05 | pt.clear indonesia | indramayu | clear.05@gmail.com | 021234xxxxxx |
+---------------+----------------------+-----------+-----------------------+--------------+
5 rows in set (0.03 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER DI TABEL BARANG
mysql> select kode_barang,nama_barang,nama_supplier,
-> kode_jenis,stock,kode_satuan,kode_lokasi,harga
-> from barang
-> inner join supplier on
-> barang.kode_supplier=supplier.kode_supplier;
+-------------+----------------+----------------------+------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | kode_jenis | stock | kode_satuan | kode_lokasi | harga |
+-------------+----------------+----------------------+------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | 1 | 200 | s01 | l01 | 2000 |
| br02 | lifeboy | pt.lifeboy global | 2 | 300 | s02 | l02 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | 3 | 700 | s03 | l03 | 15000 |
| br04 | tropical | pt.bimoli nusantara | 4 | 500 | s04 | l04 | 20000 |
| br05 | clear | pt.clear indonesia | 5 | 400 | s05 | l05 | 2000 |
+-------------+----------------+----------------------+------------+-------+-------------+-------------+-------+
5 rows in set (0.03 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER DENGAN KODE,,SUPPLIER(b),,,DI TABEL BARANG(a)
mysql> select kode_barang,nama_barang,nama_supplier,
-> kode_jenis,stock,kode_satuan,kode_lokasi,harga
-> from barang a
-> inner join supplier b on a.kode_supplier=b.kode_supplier;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | kode_jenis | stock |kode_satuan | kode_lokasi | harga |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | 1 | 200 |s01 | l01 | 2000 |
| br02 | lifeboy | pt.lifeboy global | 2 | 300 |s02 | l02 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | 3 | 700 |s03 | l03 | 15000 |
| br04 | tropical | pt.bimoli nusantara | 4 | 500 |s04 | l04 | 20000 |
| br05 | clear | pt.clear indonesia | 5 | 400 |s05 | l05 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.34 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER,NAMA_JENIS DI TABEL BARANG
mysql> select kode_barang,nama_barang,nama_supplier,
-> nama_jenis,stock,kode_satuan,kode_lokasi,harga
-> from barang
-> inner join supplier on
-> barang.kode_supplier=supplier.kode_supplier
-> inner join jenis on barang.kode_jenis=jenis.kode_jenis;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | nama_jenis | stock | kode_satuan | kode_lokasi | harga |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | deterjen | 200 | s01 | l01 | 2000 |
| br02 | lifeboy | pt.lifeboy global | sabun mandi | 300 | s02 | l02 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | rokok | 700 | s03 | l03 | 15000 |
| br04 | tropical | pt.bimoli nusantara | minyak goreng | 500 | s04 | l04 | 20000 |
| br05 | clear | pt.clear indonesia | shampo | 400 | s05 | l05 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.36 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER,NAMA_JENIS DENGAN KODE,,SUPPLIER(b),,JENIS(c),,DI TABEL BARANG(a)
mysql> select kode_barang,nama_barang,nama_supplier,
-> nama_jenis,stock,kode_satuan,kode_lokasi,harga
-> from barang a
-> inner join supplier b on a.kode_supplier=b.kode_supplier
-> inner join jenis c on a.kode_jenis=c.kode_jenis;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | nama_jenis | stock |kode_satuan | kode_lokasi | harga |+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | deterjen | 200 |s01 | l01 | 2000 |
| br02 | lifeboy | pt.lifeboy global | sabun mandi | 300 |s02 | l02 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | rokok | 700 |s03 | l03 | 15000 |
| br04 | tropical | pt.bimoli nusantara | minyak goreng | 500 |s04 | l04 | 20000 |
| br05 | clear | pt.clear indonesia | shampo | 400 |s05 | l05 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.34 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER,NAMA_JENIS,NAMA_SATUAN,NAMA_LOKASI DI TABEL BARANG
mysql> select kode_barang,nama_barang,nama_supplier,
-> nama_jenis,stock,nama_satuan,nama_lokasi,harga
-> from barang
-> inner join supplier on barang.kode_supplier=supplier.kode_supplier
-> inner join jenis on barang.kode_jenis=jenis.kode_jenis
-> inner join satuan on barang.kode_satuan=satuan.kode_satuan
-> inner join lokasi on barang.kode_lokasi=lokasi.kode_lokasi;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | nama_jenis | stock | nama_satuan | nama_lokasi | harga |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | deterjen | 200 | kilogram | rak A1 | 2000 |
| br02 | lifeboy | pt.lifeboy global | sabun mandi | 300 | gram | rak A2 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | rokok | 700 | dus | rak A3 | 15000 |
| br04 | tropical | pt.bimoli nusantara | minyak goreng | 500 | liter | rak A4 | 20000 |
| br05 | clear | pt.clear indonesia | shampo | 400 | sachet | rak A5 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.02 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER,NAMA_JENIS,NAMA_SATUAN,NAMA_LOKASI DENGAN KODE,,SUPPLIER(b),,JENIS(c),,SATUAN(d),,LOKASI(e),,DI TABEL BARANG(a)
mysql> select kode_barang,nama_barang,nama_supplier,
-> nama_jenis,stock,nama_satuan,nama_lokasi,harga
-> from barang a
-> inner join supplier b on a.kode_supplier=b.kode_supplier
-> inner join jenis c on a.kode_jenis=c.kode_jenis
-> inner join satuan d on a.kode_satuan=d.kode_satuan
-> inner join lokasi e on a.kode_lokasi=e.kode_lokasi;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | nama_jenis | stock |nama_satuan | nama_lokasi | harga |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | deterjen | 200 |kilogram | rak A1 | 2000 |
| br02 | lifeboy | pt.lifeboy global | sabun mandi | 300 |gram | rak A2 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | rokok | 700 |dus | rak A3 | 15000 |
| br04 | tropical | pt.bimoli nusantara | minyak goreng | 500 |liter | rak A4 | 20000 |
| br05 | clear | pt.clear indonesia | shampo | 400 |sachet | rak A5 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.00 sec)
PERINTAH INNER JOIN MENAMPILKAN KODE_SUPPLIER,NAMA_SUPPLIER,NAMA_JENIS,NAMA_SATUAN,NAMA_LOKASI DI TABEL BARANG
mysql> select kode_barang,nama_barang,supplier.kode_supplier,nama_supplier,
-> nama_jenis,stock,nama_satuan,nama_lokasi,harga
-> from barang
-> inner join supplier on barang.kode_supplier=supplier.kode_supplier
-> inner join jenis on barang.kode_jenis=jenis.kode_jenis
-> inner join satuan on barang.kode_satuan=satuan.kode_satuan
-> inner join lokasi on barang.kode_lokasi=lokasi.kode_lokasi;
+-------------+------------+-------------+--------------+-----------+-------+-------------+------------+-------+
| kode_barang | nama_barang|kode_supplier| nama_supplier| nama_jenis| stock | nama_satuan |nama_lokasi | harga |
+-------------+------------+-------------+--------------+-----------+-------+-------------+------------+-------+
| br01 | rinso | sp01 |pt.deterjen nusantar|deterjen| 200 | kilogram | rak A1 | 2000 |
| br02 | lifeboy | sp02 | pt.lifeboy global | sabun mandi|300| gram | rak A2 | 3000 |
| br03 | sampoerna mild | sp03 | pt.djarum indonesia| rokok |700| dus | rak A3 | 15000 |
| br04 | tropical | sp04 | pt.bimoli nusantara| minyak goreng|500| liter | rakA4 | 20000 |
| br05 | clear | sp05 | pt.clear indonesia | shampo |400| sachet | rak A5 | 2000 |
+-------------+------------+-------------+--------------------+--------------+---+--------+------------+-------+
5 rows in set (0.00 sec)
mysql>
PERINTAH INNER JOIN MENAMPILKAN KODE_SUPPLIER,NAMA_SUPPLIER,NAMA_JENIS,NAMA_SATUAN,NAMA_LOKASI DENGAN KODE,,SUPPLIER(b),,JENIS(c),,SATUAN(d),,LOKASI(e),,DI TABEL BARANG(a)
mysql> select kode_barang,nama_barang,b.kode_supplier,nama_supplier,
-> nama_jenis,stock,nama_satuan,nama_lokasi,harga
-> from barang a
-> inner join supplier b on a.kode_supplier=b.kode_supplier
-> inner join jenis c on a.kode_jenis=c.kode_jenis
-> inner join satuan d on a.kode_satuan=d.kode_satuan
-> inner join lokasi e on a.kode_lokasi=e.kode_lokasi;
+-------------+------------+-------------+--------------+-----------+-------+-------------+------------+-------+
| kode_barang | nama_barang|kode_supplier| nama_supplier| nama_jenis| stock | nama_satuan |nama_lokasi | harga |
+-------------+------------+-------------+--------------+-----------+-------+-------------+------------+-------+
| br01 | rinso | sp01 |pt.deterjen nusantar|deterjen |200 | kilogram | rak A1 | 2000 |
| br02 | lifeboy | sp02 | pt.lifeboy global |sabun mandi|300 | gram | rak A2 | 3000 |
| br03 | sampoerna mild | sp03 | pt.djarum indonesia|rokok |700 | dus | rak A3 | 15000 |
| br04 | tropical | sp04 | pt.bimoli nusantara|minyak goreng|500| liter | rakA4 | 20000 |
| br05 | clear | sp05 | pt.clear indonesia |shampo |400 | sachet | rak A5 | 2000 |
+-------------+------------+-------------+--------------------+-----------+----+----------+------------+-------+
5 rows in set (0.00 sec)
mysql>
mysql> desc transaksi;
+----------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+----------+------+-----+---------+-------+
| kode_transaksi | char(15) | NO | PRI | NULL | |
| tanggal | date | YES | | NULL | |
| jam | time | YES | | NULL | |
| kode_customer | char(6) | YES | MUL | NULL | |
| total | int(10) | YES | | NULL | |
| kode_petugas | char(10) | YES | MUL | NULL | |
+----------------+----------+------+-----+---------+-------+
6 rows in set (0.36 sec)
mysql> select * from transaksi;
+----------------+------------+----------+---------------+--------+-------------
-+
| kode_transaksi | tanggal | jam | kode_customer | total | kode_petugas
|
+----------------+------------+----------+---------------+--------+-------------
-+
| tr01 | 2014-07-20 | 08:45:00 | cs01 | 100000 | p001
|
| tr02 | 2014-08-15 | 20:10:00 | cs02 | 200000 | p002
|
| tr03 | 2014-09-23 | 09:30:00 | cs03 | 900000 | p003
|
| tr04 | 2014-09-25 | 12:30:00 | cs04 | 800000 | p004
|
| tr05 | 2014-08-17 | 18:30:00 | cs05 | 100000 | p005
|
+----------------+------------+----------+---------------+--------+-------------
-+
5 rows in set (0.00 sec)
mysql> select kode_transaksi,tanggal,jam,customer.kode_customer,nama_customer,
-> nama_petugas,total
-> from transaksi
-> inner join customer on transaksi.kode_customer=customer.kode_customer
-> inner join petugas on transaksi.kode_petugas =petugas.kode_petugas;
+----------------+------------+----------+---------------+----------------+-----
-----------+--------+
| kode_transaksi | tanggal | jam | kode_customer | nama_customer | nama
_petugas | total |
+----------------+------------+----------+---------------+----------------+-----
-----------+--------+
| tr01 | 2014-07-20 | 08:45:00 | cs01 | m.edi santoso | edi
zaky | 100000 |
| tr02 | 2014-08-15 | 20:10:00 | cs02 | tofik survey | lina
.karlina | 200000 |
| tr03 | 2014-09-23 | 09:30:00 | cs03 | erni nurzhaety | andr
e wiliam | 900000 |
| tr04 | 2014-09-25 | 12:30:00 | cs04 | lina karlina | yuni
ta fitri | 800000 |
| tr05 | 2014-08-17 | 18:30:00 | cs05 | mia miun | erni
nurzhaety | 100000 |
+----------------+------------+----------+---------------+----------------+-----
-----------+--------+
5 rows in set (0.00 sec)
mysql> select kode_transaksi,tanggal,jam,nama_customer,kode_petugas,total
-> from transaksi
-> inner join customer on transaksi.kode_customer=customer.kode_customer;
+----------------+------------+----------+----------------+--------------+------
--+
| kode_transaksi | tanggal | jam | nama_customer | kode_petugas | total
|
+----------------+------------+----------+----------------+--------------+------
--+
| tr01 | 2014-07-20 | 08:45:00 | m.edi santoso | p001 | 10000
0 |
| tr02 | 2014-08-15 | 20:10:00 | tofik survey | p002 | 20000
0 |
| tr03 | 2014-09-23 | 09:30:00 | erni nurzhaety | p003 | 90000
0 |
| tr04 | 2014-09-25 | 12:30:00 | lina karlina | p004 | 80000
0 |
| tr05 | 2014-08-17 | 18:30:00 | mia miun | p005 | 10000
0 |
+----------------+------------+----------+----------------+--------------+------
--+
5 rows in set (0.00 sec)
mysql> select kode_transaksi,tanggal,jam,customer.kode_customer,nama_customer,
-> petugas.kode_petugas,nama_petugas,total
-> from transaksi
-> inner join customer on transaksi.kode_customer=customer.kode_customer
-> inner join petugas on transaksi.kode_petugas =petugas.kode_petugas;
+----------------+------------+----------+---------------+----------------+-----
---------+----------------+--------+
| kode_transaksi | tanggal | jam | kode_customer | nama_customer | kode
_petugas | nama_petugas | total |
+----------------+------------+----------+---------------+----------------+-----
---------+----------------+--------+
| tr01 | 2014-07-20 | 08:45:00 | cs01 | m.edi santoso | p001
| edi zaky | 100000 |
| tr02 | 2014-08-15 | 20:10:00 | cs02 | tofik survey | p002
| lina.karlina | 200000 |
| tr03 | 2014-09-23 | 09:30:00 | cs03 | erni nurzhaety | p003
| andre wiliam | 900000 |
| tr04 | 2014-09-25 | 12:30:00 | cs04 | lina karlina | p004
| yunita fitri | 800000 |
| tr05 | 2014-08-17 | 18:30:00 | cs05 | mia miun | p005
| erni nurzhaety | 100000 |
+----------------+------------+----------+---------------+----------------+-----
---------+----------------+--------+
5 rows in set (0.00 sec)
mysql> desc detail_transaksi;
+----------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+----------+------+-----+---------+----------------+
| kode_detail | int(11) | NO | PRI | NULL | auto_increment |
| kode_transaksi | char(15) | YES | MUL | NULL | |
| kode_barang | char(12) | YES | MUL | NULL | |
| harga | int(10) | YES | | NULL | |
| qty | int(4) | YES | | NULL | |
| sub_total | int(10) | YES | | NULL | |
+----------------+----------+------+-----+---------+----------------+
6 rows in set (0.34 sec)
mysql> select * from detail_transaksi;
+-------------+----------------+-------------+-------+------+-----------+
| kode_detail | kode_transaksi | kode_barang | harga | qty | sub_total |
+-------------+----------------+-------------+-------+------+-----------+
| 1 | tr01 | br01 | 2000 | 200 | 400000 |
| 2 | tr02 | br02 | 3000 | 300 | 900000 |
| 3 | tr03 | br03 | 15000 | 700 | 10500000 |
| 4 | tr04 | br04 | 20000 | 500 | 10000000 |
| 5 | tr05 | br05 | 2000 | 400 | 800000 |
+-------------+----------------+-------------+-------+------+-----------+
5 rows in set (0.00 sec)
mysql> select kode_detail,tanggal,jam,nama_barang,barang.harga,qty,sub_total
-> from detail_transaksi
-> inner join transaksi on detail_transaksi.kode_transaksi
-> =transaksi.kode_transaksi
-> inner join barang on detail_transaksi.kode_barang
-> =barang.kode_barang;
+-------------+------------+----------+----------------+-------+------+---------
--+
| kode_detail | tanggal | jam | nama_barang | harga | qty | sub_tota
l |
+-------------+------------+----------+----------------+-------+------+---------
--+
| 1 | 2014-07-20 | 08:45:00 | rinso | 2000 | 200 | 40000
0 |
| 2 | 2014-08-15 | 20:10:00 | lifeboy | 3000 | 300 | 90000
0 |
| 3 | 2014-09-23 | 09:30:00 | sampoerna mild | 15000 | 700 | 1050000
0 |
| 4 | 2014-09-25 | 12:30:00 | tropical | 20000 | 500 | 1000000
0 |
| 5 | 2014-08-17 | 18:30:00 | clear | 2000 | 400 | 80000
0 |
+-------------+------------+----------+----------------+-------+------+---------
--+
5 rows in set (0.01 sec)
mysql> select kode_detail,transaksi.kode_customer,tanggal,jam,nama_barang,
-> barang.harga,qty,sub_total
-> from detail_transaksi
-> inner join transaksi on detail_transaksi.kode_transaksi
-> =transaksi.kode_transaksi
-> inner join barang on detail_transaksi.kode_barang
-> =barang.kode_barang;
+-------------+---------------+------------+----------+----------------+-------+
------+-----------+
| kode_detail | kode_customer | tanggal | jam | nama_barang | harga |
qty | sub_total |
+-------------+---------------+------------+----------+----------------+-------+
------+-----------+
| 1 | cs01 | 2014-07-20 | 08:45:00 | rinso | 2000 |
200 | 400000 |
| 2 | cs02 | 2014-08-15 | 20:10:00 | lifeboy | 3000 |
300 | 900000 |
| 3 | cs03 | 2014-09-23 | 09:30:00 | sampoerna mild | 15000 |
700 | 10500000 |
| 4 | cs04 | 2014-09-25 | 12:30:00 | tropical | 20000 |
500 | 10000000 |
| 5 | cs05 | 2014-08-17 | 18:30:00 | clear | 2000 |
400 | 800000 |
+-------------+---------------+------------+----------+----------------+-------+
------+-----------+
5 rows in set (0.00 sec)
mysql> desc detail_transaksi;
+----------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+----------+------+-----+---------+----------------+
| kode_detail | int(11) | NO | PRI | NULL | auto_increment |
| kode_transaksi | char(15) | YES | MUL | NULL | |
| kode_barang | char(12) | YES | MUL | NULL | |
| harga | int(10) | YES | | NULL | |
| qty | int(4) | YES | | NULL | |
| sub_total | int(10) | YES | | NULL | |
+----------------+----------+------+-----+---------+----------------+
6 rows in set (0.02 sec)
mysql> select transaksi.kode_transaksi,tanggal,jam,customer.nama_customer,
-> total,petugas.nama_petugas,barang.kode_barang,barang.nama_barang,
-> barang.harga,qty
-> from detail_transaksi
-> inner join transaksi on detail_transaksi.kode_transaksi
-> =transaksi.kode_transaksi
-> inner join customer on transaksi.kode_customer
-> =customer.kode_customer
-> inner join petugas on transaksi.kode_petugas
-> =petugas.kode_petugas
-> inner join barang on detail_transaksi.kode_barang
-> =barang.kode_barang;
+----------------+------------+----------+----------------+--------+------------
----+-------------+----------------+-------+------+
| kode_transaksi | tanggal | jam | nama_customer | total | nama_petuga
s | kode_barang | nama_barang | harga | qty |
+----------------+------------+----------+----------------+--------+------------
----+-------------+----------------+-------+------+
| tr01 | 2014-07-20 | 08:45:00 | m.edi santoso | 100000 | edi zaky
| br01 | rinso | 2000 | 200 |
| tr02 | 2014-08-15 | 20:10:00 | tofik survey | 200000 | lina.karlin
a | br02 | lifeboy | 3000 | 300 |
| tr03 | 2014-09-23 | 09:30:00 | erni nurzhaety | 900000 | andre wilia
m | br03 | sampoerna mild | 15000 | 700 |
| tr04 | 2014-09-25 | 12:30:00 | lina karlina | 800000 | yunita fitr
i | br04 | tropical | 20000 | 500 |
| tr05 | 2014-08-17 | 18:30:00 | mia miun | 100000 | erni nurzha
ety | br05 | clear | 2000 | 400 |
+----------------+------------+----------+----------------+--------+------------
----+-------------+----------------+-------+------+
5 rows in set (0.00 sec)
mysql>
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\EDI SANTOSO>cd/xampp/mysql/bin
C:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.8 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use database_penjualan;
Database changed
mysql> show tables;
+------------------------------+
| Tables_in_database_penjualan |
+------------------------------+
| barang |
| customer |
| detail_transaksi |
| jenis |
| lokasi |
| petugas |
| satuan |
| supplier |
| transaksi |
+------------------------------+
9 rows in set (0.02 sec)
mysql> select * from barang;
+-------------+----------------+---------------+------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | kode_supplier | kode_jenis | stock | kode_satuan | kode_lokasi | harga |
+-------------+----------------+---------------+------------+-------+-------------+-------------+-------+
| br01 | rinso | sp01 | 1 | 200 | s01 | l01 | 2000 |
| br02 | lifeboy | sp02 | 2 | 300 | s02 | l02 | 3000 |
| br03 | sampoerna mild | sp03 | 3 | 700 | s03 | l03 | 15000 |
| br04 | tropical | sp04 | 4 | 500 | s04 | l04 | 20000 |
| br05 | clear | sp05 | 5 | 400 | s05 | l05 | 2000 |
+-------------+----------------+---------------+------------+-------+-------------+-------------+-------+
5 rows in set (0.02 sec)
mysql> select* from supplier;
+---------------+----------------------+-----------+-----------------------+--------------+
| kode_supplier | nama_supplier | alamat | email | no_telp |
+---------------+----------------------+-----------+-----------------------+--------------+
| sp01 | pt.deterjen nusantar | jakarta | deterjen.01@yahoo.com | 021777xxxxxx |
| sp02 | pt.lifeboy global | jakarta | lifeboy.02@yahoo.com | 021232xxxxxx |
| sp03 | pt.djarum indonesia | banten | djarum.03@gmail.com | 021999xxxxxx |
| sp04 | pt.bimoli nusantara | jakarta | bimoli.04@gmail.com | 021222xxxxxx |
| sp05 | pt.clear indonesia | indramayu | clear.05@gmail.com | 021234xxxxxx |
+---------------+----------------------+-----------+-----------------------+--------------+
5 rows in set (0.03 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER DI TABEL BARANG
mysql> select kode_barang,nama_barang,nama_supplier,
-> kode_jenis,stock,kode_satuan,kode_lokasi,harga
-> from barang
-> inner join supplier on
-> barang.kode_supplier=supplier.kode_supplier;
+-------------+----------------+----------------------+------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | kode_jenis | stock | kode_satuan | kode_lokasi | harga |
+-------------+----------------+----------------------+------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | 1 | 200 | s01 | l01 | 2000 |
| br02 | lifeboy | pt.lifeboy global | 2 | 300 | s02 | l02 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | 3 | 700 | s03 | l03 | 15000 |
| br04 | tropical | pt.bimoli nusantara | 4 | 500 | s04 | l04 | 20000 |
| br05 | clear | pt.clear indonesia | 5 | 400 | s05 | l05 | 2000 |
+-------------+----------------+----------------------+------------+-------+-------------+-------------+-------+
5 rows in set (0.03 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER DENGAN KODE,,SUPPLIER(b),,,DI TABEL BARANG(a)
mysql> select kode_barang,nama_barang,nama_supplier,
-> kode_jenis,stock,kode_satuan,kode_lokasi,harga
-> from barang a
-> inner join supplier b on a.kode_supplier=b.kode_supplier;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | kode_jenis | stock |kode_satuan | kode_lokasi | harga |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | 1 | 200 |s01 | l01 | 2000 |
| br02 | lifeboy | pt.lifeboy global | 2 | 300 |s02 | l02 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | 3 | 700 |s03 | l03 | 15000 |
| br04 | tropical | pt.bimoli nusantara | 4 | 500 |s04 | l04 | 20000 |
| br05 | clear | pt.clear indonesia | 5 | 400 |s05 | l05 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.34 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER,NAMA_JENIS DI TABEL BARANG
mysql> select kode_barang,nama_barang,nama_supplier,
-> nama_jenis,stock,kode_satuan,kode_lokasi,harga
-> from barang
-> inner join supplier on
-> barang.kode_supplier=supplier.kode_supplier
-> inner join jenis on barang.kode_jenis=jenis.kode_jenis;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | nama_jenis | stock | kode_satuan | kode_lokasi | harga |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | deterjen | 200 | s01 | l01 | 2000 |
| br02 | lifeboy | pt.lifeboy global | sabun mandi | 300 | s02 | l02 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | rokok | 700 | s03 | l03 | 15000 |
| br04 | tropical | pt.bimoli nusantara | minyak goreng | 500 | s04 | l04 | 20000 |
| br05 | clear | pt.clear indonesia | shampo | 400 | s05 | l05 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.36 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER,NAMA_JENIS DENGAN KODE,,SUPPLIER(b),,JENIS(c),,DI TABEL BARANG(a)
mysql> select kode_barang,nama_barang,nama_supplier,
-> nama_jenis,stock,kode_satuan,kode_lokasi,harga
-> from barang a
-> inner join supplier b on a.kode_supplier=b.kode_supplier
-> inner join jenis c on a.kode_jenis=c.kode_jenis;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | nama_jenis | stock |kode_satuan | kode_lokasi | harga |+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | deterjen | 200 |s01 | l01 | 2000 |
| br02 | lifeboy | pt.lifeboy global | sabun mandi | 300 |s02 | l02 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | rokok | 700 |s03 | l03 | 15000 |
| br04 | tropical | pt.bimoli nusantara | minyak goreng | 500 |s04 | l04 | 20000 |
| br05 | clear | pt.clear indonesia | shampo | 400 |s05 | l05 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.34 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER,NAMA_JENIS,NAMA_SATUAN,NAMA_LOKASI DI TABEL BARANG
mysql> select kode_barang,nama_barang,nama_supplier,
-> nama_jenis,stock,nama_satuan,nama_lokasi,harga
-> from barang
-> inner join supplier on barang.kode_supplier=supplier.kode_supplier
-> inner join jenis on barang.kode_jenis=jenis.kode_jenis
-> inner join satuan on barang.kode_satuan=satuan.kode_satuan
-> inner join lokasi on barang.kode_lokasi=lokasi.kode_lokasi;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | nama_jenis | stock | nama_satuan | nama_lokasi | harga |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | deterjen | 200 | kilogram | rak A1 | 2000 |
| br02 | lifeboy | pt.lifeboy global | sabun mandi | 300 | gram | rak A2 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | rokok | 700 | dus | rak A3 | 15000 |
| br04 | tropical | pt.bimoli nusantara | minyak goreng | 500 | liter | rak A4 | 20000 |
| br05 | clear | pt.clear indonesia | shampo | 400 | sachet | rak A5 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.02 sec)
PERINTAH INNER JOIN MENAMPILKAN NAMA_SUPPLIER,NAMA_JENIS,NAMA_SATUAN,NAMA_LOKASI DENGAN KODE,,SUPPLIER(b),,JENIS(c),,SATUAN(d),,LOKASI(e),,DI TABEL BARANG(a)
mysql> select kode_barang,nama_barang,nama_supplier,
-> nama_jenis,stock,nama_satuan,nama_lokasi,harga
-> from barang a
-> inner join supplier b on a.kode_supplier=b.kode_supplier
-> inner join jenis c on a.kode_jenis=c.kode_jenis
-> inner join satuan d on a.kode_satuan=d.kode_satuan
-> inner join lokasi e on a.kode_lokasi=e.kode_lokasi;
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| kode_barang | nama_barang | nama_supplier | nama_jenis | stock |nama_satuan | nama_lokasi | harga |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
| br01 | rinso | pt.deterjen nusantar | deterjen | 200 |kilogram | rak A1 | 2000 |
| br02 | lifeboy | pt.lifeboy global | sabun mandi | 300 |gram | rak A2 | 3000 |
| br03 | sampoerna mild | pt.djarum indonesia | rokok | 700 |dus | rak A3 | 15000 |
| br04 | tropical | pt.bimoli nusantara | minyak goreng | 500 |liter | rak A4 | 20000 |
| br05 | clear | pt.clear indonesia | shampo | 400 |sachet | rak A5 | 2000 |
+-------------+----------------+----------------------+---------------+-------+-------------+-------------+-------+
5 rows in set (0.00 sec)
PERINTAH INNER JOIN MENAMPILKAN KODE_SUPPLIER,NAMA_SUPPLIER,NAMA_JENIS,NAMA_SATUAN,NAMA_LOKASI DI TABEL BARANG
mysql> select kode_barang,nama_barang,supplier.kode_supplier,nama_supplier,
-> nama_jenis,stock,nama_satuan,nama_lokasi,harga
-> from barang
-> inner join supplier on barang.kode_supplier=supplier.kode_supplier
-> inner join jenis on barang.kode_jenis=jenis.kode_jenis
-> inner join satuan on barang.kode_satuan=satuan.kode_satuan
-> inner join lokasi on barang.kode_lokasi=lokasi.kode_lokasi;
+-------------+------------+-------------+--------------+-----------+-------+-------------+------------+-------+
| kode_barang | nama_barang|kode_supplier| nama_supplier| nama_jenis| stock | nama_satuan |nama_lokasi | harga |
+-------------+------------+-------------+--------------+-----------+-------+-------------+------------+-------+
| br01 | rinso | sp01 |pt.deterjen nusantar|deterjen| 200 | kilogram | rak A1 | 2000 |
| br02 | lifeboy | sp02 | pt.lifeboy global | sabun mandi|300| gram | rak A2 | 3000 |
| br03 | sampoerna mild | sp03 | pt.djarum indonesia| rokok |700| dus | rak A3 | 15000 |
| br04 | tropical | sp04 | pt.bimoli nusantara| minyak goreng|500| liter | rakA4 | 20000 |
| br05 | clear | sp05 | pt.clear indonesia | shampo |400| sachet | rak A5 | 2000 |
+-------------+------------+-------------+--------------------+--------------+---+--------+------------+-------+
5 rows in set (0.00 sec)
mysql>
PERINTAH INNER JOIN MENAMPILKAN KODE_SUPPLIER,NAMA_SUPPLIER,NAMA_JENIS,NAMA_SATUAN,NAMA_LOKASI DENGAN KODE,,SUPPLIER(b),,JENIS(c),,SATUAN(d),,LOKASI(e),,DI TABEL BARANG(a)
mysql> select kode_barang,nama_barang,b.kode_supplier,nama_supplier,
-> nama_jenis,stock,nama_satuan,nama_lokasi,harga
-> from barang a
-> inner join supplier b on a.kode_supplier=b.kode_supplier
-> inner join jenis c on a.kode_jenis=c.kode_jenis
-> inner join satuan d on a.kode_satuan=d.kode_satuan
-> inner join lokasi e on a.kode_lokasi=e.kode_lokasi;
+-------------+------------+-------------+--------------+-----------+-------+-------------+------------+-------+
| kode_barang | nama_barang|kode_supplier| nama_supplier| nama_jenis| stock | nama_satuan |nama_lokasi | harga |
+-------------+------------+-------------+--------------+-----------+-------+-------------+------------+-------+
| br01 | rinso | sp01 |pt.deterjen nusantar|deterjen |200 | kilogram | rak A1 | 2000 |
| br02 | lifeboy | sp02 | pt.lifeboy global |sabun mandi|300 | gram | rak A2 | 3000 |
| br03 | sampoerna mild | sp03 | pt.djarum indonesia|rokok |700 | dus | rak A3 | 15000 |
| br04 | tropical | sp04 | pt.bimoli nusantara|minyak goreng|500| liter | rakA4 | 20000 |
| br05 | clear | sp05 | pt.clear indonesia |shampo |400 | sachet | rak A5 | 2000 |
+-------------+------------+-------------+--------------------+-----------+----+----------+------------+-------+
5 rows in set (0.00 sec)
mysql>
mysql> desc transaksi;
+----------------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+----------+------+-----+---------+-------+
| kode_transaksi | char(15) | NO | PRI | NULL | |
| tanggal | date | YES | | NULL | |
| jam | time | YES | | NULL | |
| kode_customer | char(6) | YES | MUL | NULL | |
| total | int(10) | YES | | NULL | |
| kode_petugas | char(10) | YES | MUL | NULL | |
+----------------+----------+------+-----+---------+-------+
6 rows in set (0.36 sec)
mysql> select * from transaksi;
+----------------+------------+----------+---------------+--------+-------------
-+
| kode_transaksi | tanggal | jam | kode_customer | total | kode_petugas
|
+----------------+------------+----------+---------------+--------+-------------
-+
| tr01 | 2014-07-20 | 08:45:00 | cs01 | 100000 | p001
|
| tr02 | 2014-08-15 | 20:10:00 | cs02 | 200000 | p002
|
| tr03 | 2014-09-23 | 09:30:00 | cs03 | 900000 | p003
|
| tr04 | 2014-09-25 | 12:30:00 | cs04 | 800000 | p004
|
| tr05 | 2014-08-17 | 18:30:00 | cs05 | 100000 | p005
|
+----------------+------------+----------+---------------+--------+-------------
-+
5 rows in set (0.00 sec)
mysql> select kode_transaksi,tanggal,jam,customer.kode_customer,nama_customer,
-> nama_petugas,total
-> from transaksi
-> inner join customer on transaksi.kode_customer=customer.kode_customer
-> inner join petugas on transaksi.kode_petugas =petugas.kode_petugas;
+----------------+------------+----------+---------------+----------------+-----
-----------+--------+
| kode_transaksi | tanggal | jam | kode_customer | nama_customer | nama
_petugas | total |
+----------------+------------+----------+---------------+----------------+-----
-----------+--------+
| tr01 | 2014-07-20 | 08:45:00 | cs01 | m.edi santoso | edi
zaky | 100000 |
| tr02 | 2014-08-15 | 20:10:00 | cs02 | tofik survey | lina
.karlina | 200000 |
| tr03 | 2014-09-23 | 09:30:00 | cs03 | erni nurzhaety | andr
e wiliam | 900000 |
| tr04 | 2014-09-25 | 12:30:00 | cs04 | lina karlina | yuni
ta fitri | 800000 |
| tr05 | 2014-08-17 | 18:30:00 | cs05 | mia miun | erni
nurzhaety | 100000 |
+----------------+------------+----------+---------------+----------------+-----
-----------+--------+
5 rows in set (0.00 sec)
mysql> select kode_transaksi,tanggal,jam,nama_customer,kode_petugas,total
-> from transaksi
-> inner join customer on transaksi.kode_customer=customer.kode_customer;
+----------------+------------+----------+----------------+--------------+------
--+
| kode_transaksi | tanggal | jam | nama_customer | kode_petugas | total
|
+----------------+------------+----------+----------------+--------------+------
--+
| tr01 | 2014-07-20 | 08:45:00 | m.edi santoso | p001 | 10000
0 |
| tr02 | 2014-08-15 | 20:10:00 | tofik survey | p002 | 20000
0 |
| tr03 | 2014-09-23 | 09:30:00 | erni nurzhaety | p003 | 90000
0 |
| tr04 | 2014-09-25 | 12:30:00 | lina karlina | p004 | 80000
0 |
| tr05 | 2014-08-17 | 18:30:00 | mia miun | p005 | 10000
0 |
+----------------+------------+----------+----------------+--------------+------
--+
5 rows in set (0.00 sec)
mysql> select kode_transaksi,tanggal,jam,customer.kode_customer,nama_customer,
-> petugas.kode_petugas,nama_petugas,total
-> from transaksi
-> inner join customer on transaksi.kode_customer=customer.kode_customer
-> inner join petugas on transaksi.kode_petugas =petugas.kode_petugas;
+----------------+------------+----------+---------------+----------------+-----
---------+----------------+--------+
| kode_transaksi | tanggal | jam | kode_customer | nama_customer | kode
_petugas | nama_petugas | total |
+----------------+------------+----------+---------------+----------------+-----
---------+----------------+--------+
| tr01 | 2014-07-20 | 08:45:00 | cs01 | m.edi santoso | p001
| edi zaky | 100000 |
| tr02 | 2014-08-15 | 20:10:00 | cs02 | tofik survey | p002
| lina.karlina | 200000 |
| tr03 | 2014-09-23 | 09:30:00 | cs03 | erni nurzhaety | p003
| andre wiliam | 900000 |
| tr04 | 2014-09-25 | 12:30:00 | cs04 | lina karlina | p004
| yunita fitri | 800000 |
| tr05 | 2014-08-17 | 18:30:00 | cs05 | mia miun | p005
| erni nurzhaety | 100000 |
+----------------+------------+----------+---------------+----------------+-----
---------+----------------+--------+
5 rows in set (0.00 sec)
mysql> desc detail_transaksi;
+----------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+----------+------+-----+---------+----------------+
| kode_detail | int(11) | NO | PRI | NULL | auto_increment |
| kode_transaksi | char(15) | YES | MUL | NULL | |
| kode_barang | char(12) | YES | MUL | NULL | |
| harga | int(10) | YES | | NULL | |
| qty | int(4) | YES | | NULL | |
| sub_total | int(10) | YES | | NULL | |
+----------------+----------+------+-----+---------+----------------+
6 rows in set (0.34 sec)
mysql> select * from detail_transaksi;
+-------------+----------------+-------------+-------+------+-----------+
| kode_detail | kode_transaksi | kode_barang | harga | qty | sub_total |
+-------------+----------------+-------------+-------+------+-----------+
| 1 | tr01 | br01 | 2000 | 200 | 400000 |
| 2 | tr02 | br02 | 3000 | 300 | 900000 |
| 3 | tr03 | br03 | 15000 | 700 | 10500000 |
| 4 | tr04 | br04 | 20000 | 500 | 10000000 |
| 5 | tr05 | br05 | 2000 | 400 | 800000 |
+-------------+----------------+-------------+-------+------+-----------+
5 rows in set (0.00 sec)
mysql> select kode_detail,tanggal,jam,nama_barang,barang.harga,qty,sub_total
-> from detail_transaksi
-> inner join transaksi on detail_transaksi.kode_transaksi
-> =transaksi.kode_transaksi
-> inner join barang on detail_transaksi.kode_barang
-> =barang.kode_barang;
+-------------+------------+----------+----------------+-------+------+---------
--+
| kode_detail | tanggal | jam | nama_barang | harga | qty | sub_tota
l |
+-------------+------------+----------+----------------+-------+------+---------
--+
| 1 | 2014-07-20 | 08:45:00 | rinso | 2000 | 200 | 40000
0 |
| 2 | 2014-08-15 | 20:10:00 | lifeboy | 3000 | 300 | 90000
0 |
| 3 | 2014-09-23 | 09:30:00 | sampoerna mild | 15000 | 700 | 1050000
0 |
| 4 | 2014-09-25 | 12:30:00 | tropical | 20000 | 500 | 1000000
0 |
| 5 | 2014-08-17 | 18:30:00 | clear | 2000 | 400 | 80000
0 |
+-------------+------------+----------+----------------+-------+------+---------
--+
5 rows in set (0.01 sec)
mysql> select kode_detail,transaksi.kode_customer,tanggal,jam,nama_barang,
-> barang.harga,qty,sub_total
-> from detail_transaksi
-> inner join transaksi on detail_transaksi.kode_transaksi
-> =transaksi.kode_transaksi
-> inner join barang on detail_transaksi.kode_barang
-> =barang.kode_barang;
+-------------+---------------+------------+----------+----------------+-------+
------+-----------+
| kode_detail | kode_customer | tanggal | jam | nama_barang | harga |
qty | sub_total |
+-------------+---------------+------------+----------+----------------+-------+
------+-----------+
| 1 | cs01 | 2014-07-20 | 08:45:00 | rinso | 2000 |
200 | 400000 |
| 2 | cs02 | 2014-08-15 | 20:10:00 | lifeboy | 3000 |
300 | 900000 |
| 3 | cs03 | 2014-09-23 | 09:30:00 | sampoerna mild | 15000 |
700 | 10500000 |
| 4 | cs04 | 2014-09-25 | 12:30:00 | tropical | 20000 |
500 | 10000000 |
| 5 | cs05 | 2014-08-17 | 18:30:00 | clear | 2000 |
400 | 800000 |
+-------------+---------------+------------+----------+----------------+-------+
------+-----------+
5 rows in set (0.00 sec)
mysql> desc detail_transaksi;
+----------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+----------+------+-----+---------+----------------+
| kode_detail | int(11) | NO | PRI | NULL | auto_increment |
| kode_transaksi | char(15) | YES | MUL | NULL | |
| kode_barang | char(12) | YES | MUL | NULL | |
| harga | int(10) | YES | | NULL | |
| qty | int(4) | YES | | NULL | |
| sub_total | int(10) | YES | | NULL | |
+----------------+----------+------+-----+---------+----------------+
6 rows in set (0.02 sec)
mysql> select transaksi.kode_transaksi,tanggal,jam,customer.nama_customer,
-> total,petugas.nama_petugas,barang.kode_barang,barang.nama_barang,
-> barang.harga,qty
-> from detail_transaksi
-> inner join transaksi on detail_transaksi.kode_transaksi
-> =transaksi.kode_transaksi
-> inner join customer on transaksi.kode_customer
-> =customer.kode_customer
-> inner join petugas on transaksi.kode_petugas
-> =petugas.kode_petugas
-> inner join barang on detail_transaksi.kode_barang
-> =barang.kode_barang;
+----------------+------------+----------+----------------+--------+------------
----+-------------+----------------+-------+------+
| kode_transaksi | tanggal | jam | nama_customer | total | nama_petuga
s | kode_barang | nama_barang | harga | qty |
+----------------+------------+----------+----------------+--------+------------
----+-------------+----------------+-------+------+
| tr01 | 2014-07-20 | 08:45:00 | m.edi santoso | 100000 | edi zaky
| br01 | rinso | 2000 | 200 |
| tr02 | 2014-08-15 | 20:10:00 | tofik survey | 200000 | lina.karlin
a | br02 | lifeboy | 3000 | 300 |
| tr03 | 2014-09-23 | 09:30:00 | erni nurzhaety | 900000 | andre wilia
m | br03 | sampoerna mild | 15000 | 700 |
| tr04 | 2014-09-25 | 12:30:00 | lina karlina | 800000 | yunita fitr
i | br04 | tropical | 20000 | 500 |
| tr05 | 2014-08-17 | 18:30:00 | mia miun | 100000 | erni nurzha
ety | br05 | clear | 2000 | 400 |
+----------------+------------+----------+----------------+--------+------------
----+-------------+----------------+-------+------+
5 rows in set (0.00 sec)
mysql>
Komentar
Posting Komentar