0% found this document useful (0 votes)
174 views9 pages

Database Penjualan

The document details the steps taken to create a database called "penjualan" in MySQL. It includes creating two tables ("tb_pelanggan" and "tb_barang") to store customer and product data, respectively. Various queries are run to insert sample data, view the database structure, and select data from the tables. In the end, the full contents of both tables are displayed to show the added records.

Uploaded by

Yentii
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
174 views9 pages

Database Penjualan

The document details the steps taken to create a database called "penjualan" in MySQL. It includes creating two tables ("tb_pelanggan" and "tb_barang") to store customer and product data, respectively. Various queries are run to insert sample data, view the database structure, and select data from the tables. In the end, the full contents of both tables are displayed to show the added records.

Uploaded by

Yentii
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

DATABASE PENJUALAN

Microsoft Windows [Version 10.0.15063]

(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\Asus>cd..\..

C:\>cd xampp\mysql\

C:\xampp\mysql>cd bin

C:\xampp\mysql\bin>mysql -u root

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 35

Server version: 10.4.24-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database penjualan;

Query OK, 1 row affected (0.002 sec)

MariaDB [(none)]> show databases;

+ +

| Database |

+ +

| barang |

| information_schema |

| mysql |

| penjualan |

| performance_schema |
| phpmyadmin |

+ +

6 rows in set (0.002 sec)

MariaDB [(none)]> use penjualan;

Database changed

MariaDB [penjualan]> create table tb_pelanggan(

-> id_pelanggan varchar(5) Primary key,

-> nm_pelanggan varchar(30) not null,

-> alamat text not null,

-> telephon varchar(20) not null,

-> email varchar(50) not null);

Query OK, 0 rows affected (0.202 sec)

MariaDB [penjualan]> show tables;

+ +

| Tables_in_penjualan |

+ +

| tb_pelanggan |

+ +

1 row in set (0.001 sec)

MariaDB [penjualan]> desc tb_pelanggan;

+ + + + + + +

| Field | Type | Null | Key | Default | Extra |

+ + + + + + +

| id_pelanggan | varchar(5) | NO | PRI | NULL | |

| nm_pelanggan | varchar(30) | NO | | NULL | |

| alamat | text | NO | | NULL | |

| telephon | varchar(20) | NO | | NULL | |


| email | varchar(50) | NO | | NULL | |
+ + + + + + +

5 rows in set (0.169 sec)

MariaDB [penjualan]> insert into tb_pelanggan values

-> ('PO001','Achmad Solichin','Jakarta Selatan','0217327762','[email protected]');

Query OK, 1 row affected (0.032 sec)

MariaDB [penjualan]> insert into tb_pelanggan values

-> ('PO002','Agus Rahman','Jl H Said, Tanggerang','0217323234','[email protected]');

Query OK, 1 row affected (0.132 sec)

MariaDB [penjualan]> insert into tb_pelanggan values

-> ('PO003','Doni Damara','Jl H Said, Tangerang','0217323234','[email protected]');

Query OK, 1 row affected (0.036 sec)

MariaDB [penjualan]> insert into tb_pelanggan values

-> ('PO004','Reni Arianti','Jl. Raya Dago No 90','0313493583','[email protected]');

Query OK, 1 row affected (0.068 sec)

MariaDB [penjualan]> insert into tb_pelanggan values

-> ('PO005','Dewi Aminah','Jl Arjuna No 40','0314584883','[email protected]');

Query OK, 1 row affected (0.121 sec)

MariaDB [penjualan]> insert into tb_pelanggan values

-> ('PO006','Chotimatul M','RT 04 RW 02 Kel Pinang sari','0219249349','[email protected]');

Query OK, 1 row affected (0.136 sec)

MariaDB [penjualan]> select*from tb_pelanggan;

+ + + + + -+

| id_pelanggan | nm_pelanggan | alamat | telephon | email |

+ + + + + -+
| PO001 | Achmad Solichin | Jakarta Selatan | 0217327762 | [email protected] |

| PO002 | Agus Rahman | Jl H Said, Tanggerang | 0217323234 | [email protected] |

| PO003 | Doni Damara | Jl H Said, Tangerang | 0217323234 | [email protected] |

| PO004 | Reni Arianti | Jl. Raya Dago No 90 | 0313493583 | [email protected] |

| PO005 | Dewi Aminah | Jl Arjuna No 40 | 0314584883 | [email protected] |

| PO006 | Chotimatul M | RT 04 RW 02 Kel Pinang sari | 0219249349 | [email protected] |

+ + + + + -+

6 rows in set (0.001 sec)

MariaDB [penjualan]> create table tb_barang(

-> kd_barang varchar(3) primary key,

-> nm_barang text not null,

-> harga varchar(20) not null,

-> jumlah varchar(5) not null);

Query OK, 0 rows affected (0.162 sec)

MariaDB [penjualan]> show tables;

+ +

| Tables_in_penjualan |

+ +

| tb_barang |

| tb_pelanggan |

+ +

2 rows in set (0.001 sec)

MariaDB [penjualan]> desc tb_barang;

+ + + + + + +

| Field | Type | Null | Key | Default | Extra |

+ + + + + + +

| kd_barang | varchar(3) | NO | PRI | NULL | |

| nm_barang | text | NO | | NULL | |


| harga | varchar(20) | NO | | NULL | |

| jumlah | varchar(5) | NO | | NULL | |

+ + + + + + +

4 rows in set (0.039 sec)

MariaDB [penjualan]> insert into tb_barang values

-> ('001','Meja','500000','3');

Query OK, 1 row affected (0.036 sec)

MariaDB [penjualan]> insert into tb_barang values

-> ('002','Lemari','1500000','13');

Query OK, 1 row affected (0.127 sec)

MariaDB [penjualan]> insert into tb_barang values

-> ('003','Kulkas','3000000','2');

Query OK, 1 row affected (0.043 sec)

MariaDB [penjualan]> insert into tb_barang values

-> ('004','televisi','2500000','10');

Query OK, 1 row affected (0.043 sec)

MariaDB [penjualan]> select*from tb_pelanggan;

+ + + + + -+

| id_pelanggan | nm_pelanggan | alamat | telephon | email |

+ + + + + -+

| PO001 | Achmad Solichin | Jakarta Selatan | 0217327762 | [email protected] |


| PO002 | Agus Rahman | Jl H Said, Tanggerang | 0217323234 | [email protected] |

| PO003 | Doni Damara | Jl H Said, Tangerang | 0217323234 | [email protected] |

| PO004 | Reni Arianti | Jl. Raya Dago No 90 | 0313493583 | [email protected] |


| PO005 | Dewi Aminah | Jl Arjuna No 40 | 0314584883 | [email protected] |

| PO006 | Chotimatul M | RT 04 RW 02 Kel Pinang sari | 0219249349 | [email protected] |

+ + + + + -+

6 rows in set (0.001 sec)


MariaDB [penjualan]> select*from tb_barang;

Tabel Barang;
+--------+----------+---------+--------+
| kd_brg | nama_brg | harga | jumlah |
+--------+----------+---------+--------+
| 001 | Meja | 500000 | 3 |
| 002 | Lemari | 1500000 | 13 |
| 003 | Kulkas | 3000000 | 2 |
| 004 | Televisi | 2500000 | 10 |
+--------+----------+---------+--------+
3 rows in set (0.001 sec)

You might also like