Thursday, October 3, 2013

membuat database penjualan buku menggunakan CMD

Tags

berikut adalah contoh :

| cdcol                  |
| contoh_triger2         |
| dbbuku                 |        
| penjualan_sepeda_motor |
| perpustakaan           |
| perusahaan             |
| phpmyadmin             |
| sepeda_motor           |
| test                   |
| webauth                |
+------------------------+
21 rows in set (0.61 sec)

mysql> use dbbuku
Database changed
mysql> show tables;

+---------------------+
| Tables_in_dbbuku    |
+---------------------+
| buku                |
| katagori            |
| link_buku_pengarang |
| penerbit            |
| pengarang           |
+---------------------+
5 rows in set (0.00 sec)

mysql> select * from buku;
+-----------+---------------+-------------+-----------------+------------------+----------------+---
---------+
| buku_isbn | judul_buku    | penerbit_id | buku_tgl_terbit | buku_jml_halaman | buku_deskripsi | bu
ku_harga |
+-----------+---------------+-------------+-----------------+------------------+----------------+---
---------+
| 001       | jarkom        | cv01        | 01              | 100              | 101            | 50
.000     |
| 002       | RDBMS         | cv02        | 02              | 150              | 102            | 55
.000     |
| 003       | Sistem_oprasi | cv03        | 03              | 200              | 103            | 60
.000     |
| 004       | RPL_LANJ      | cv04        | 04              | 210              | 104            | 65
.000     |
| 005       | IMK           | cv05        | 05              | 220              | 105            | 70
.000     |
+-----------+---------------+-------------+-----------------+------------------+----------------+---
---------+
5 rows in set (0.08 sec)

mysql> select * from katagori;
+-------------+---------------+
| id_katagori | katagori_nama |
+-------------+---------------+
| A01         | JARKOM        |
| A02         | RDBMS         |
| A03         | Sistem_oprasi |
| A04         | RPL_LANJ      |
| A05         | IMK           |
+-------------+---------------+
5 rows in set (0.08 sec)

mysql> select * from link_buku_pengarang;
+-----------+--------------+
| buku_isbn | pengarang_id |
+-----------+--------------+
| 001       | 142          |
| 002       | 143          |
| 003       | 144          |
| 004       | 145          |
| 005       | 146          |
+-----------+--------------+
5 rows in set (0.04 sec)

mysql> select * from penerbit;
+-------------+---------------+
| penerbit_id | penerbit_nama |
+-------------+---------------+
| cv01        | pustaka       |
| cv02        | penuntun      |
| cv03        | erlangga      |
| cv04        | yudistira     |
| cv05        | bina darma    |
+-------------+---------------+
5 rows in set (0.04 sec)

mysql> select * from pengarang;
+--------------+----------------+
| pengarang_id | pengarang_nama |
+--------------+----------------+
| 142          | dadang         |
| 143          | ari            |
| 144          | mukmin         |
| 145          | amran          |
| 146          | sahrul         |
+--------------+----------------+
5 rows in set (0.09 sec)

mysql> select buku_isbn,judul_buku,buku_harga from buku where buku_harga <=50.000
    -> ;
+-----------+------------+------------+
| buku_isbn | judul_buku | buku_harga |
+-----------+------------+------------+
| 001       | jarkom     | 50.000     |
+-----------+------------+------------+
1 row in set (0.05 sec)

mysql> select judul_buku,buku_harga,buku_harga * 2 from buku where buku_isbn in ('001', '002')
    -> ;
+------------+------------+----------------+
| judul_buku | buku_harga | buku_harga * 2 |
+------------+------------+----------------+
| jarkom     | 50.000     |            100 |
| RDBMS      | 55.000     |            110 |
+------------+------------+----------------+
2 rows in set (0.10 sec)

mysql> select buku_isbn,judul_buku,penerbit_id,buku_harga from buku where buku_harga <=50.000 and penerbit_id='cv01'
    -> ;
+-----------+------------+-------------+------------+
| buku_isbn | judul_buku | penerbit_id | buku_harga |
+-----------+------------+-------------+------------+
| 001       | jarkom     | cv01        | 50.000     |
+-----------+------------+-------------+------------+
1 row in set (0.00 sec)

mysql> select concat('JARKOM',' ','RDBMS');
+------------------------------+
| concat('JARKOM',' ','RDBMS') |
+------------------------------+
| JARKOM RDBMS                 |
+------------------------------+
1 row in set (0.00 sec)

mysql> select concat('JARKOM',' ','RDBMS',' ','Siste_oprasi',' ','RPL_LANJ',' ','IMK');
+--------------------------------------------------------------------------+
| concat('JARKOM',' ','RDBMS',' ','Siste_oprasi',' ','RPL_LANJ',' ','IMK') |
+--------------------------------------------------------------------------+
| JARKOM RDBMS Siste_oprasi RPL_LANJ IMK                                   |
+--------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> select length('jarkom');
+------------------+
| length('jarkom') |
+------------------+
|                6 |
+------------------+
1 row in set (0.02 sec)

mysql> select length('Sistem_oprasi');
+-------------------------+
| length('Sistem_oprasi') |
+-------------------------+
|                      13 |
+-------------------------+
1 row in set (0.00 sec)

mysql> select locate('base','pemrograman_database 1');
+-----------------------------------------+
| locate('base','pemrograman_database 1') |
+-----------------------------------------+
|                                      17 |
+-----------------------------------------+
1 row in set (0.00 sec)

mysql> select ('pemrograman_database ');
+-----------------------+
| pemrograman_database  |
+-----------------------+
| pemrograman_database  |
+-----------------------+
1 row in set (0.00 sec)

mysql> select lower('pemrograman_database ');
+--------------------------------+
| lower('pemrograman_database ') |
+--------------------------------+
| pemrograman_database           |
+--------------------------------+
1 row in set (0.00 sec)

mysql> select upper('pemrograman_database ');
+--------------------------------+
| upper('pemrograman_database ') |
+--------------------------------+
| PEMROGRAMAN_DATABASE           |
+--------------------------------+
1 row in set (0.00 sec)

mysql> set @str='mysql';
Query OK, 0 rows affected (0.00 sec)

mysql> select @srt;
+------+
| @srt |
+------+
| NULL |
+------+
1 row in set (0.00 sec)

mysql> set @str=quote('mysql');
Query OK, 0 rows affected (0.04 sec)

mysql> select @srt;
+------+
| @srt |
+------+
| NULL |
+------+
1 row in set (0.00 sec)

mysql> select replace('pemrgraman database','database','mysql');
+---------------------------------------------------+
| replace('pemrgraman database','database','mysql') |
+---------------------------------------------------+
| pemrgraman mysql                                  |
+---------------------------------------------------+
1 row in set (0.00 sec)

mysql> select substring('msql','1,2');
+-------------------------+
| substring('msql','1,2') |
+-------------------------+
| msql                    |
+-------------------------+
1 row in set, 2 warnings (0.00 sec)

mysql>

Artikel Terkait


EmoticonEmoticon