Jumat, 20 April 2012

Sistem Basis Data


Dalam pembuatan Tabel


Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\user>cd\

C:\>cd program files\xampp\mysql\bin

C:\Program Files\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.27-community

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database peminjaman_buku;
Query OK, 1 row affected (0.00 sec)

mysql> create database nama_buku;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cdcol              |
| mysql              |
| nama_buku          |
| peminjaman_buku    |
| phpmyadmin         |
| test               |
| webauth            |
+--------------------+
8 rows in set (0.02 sec)

mysql> use nama_buku;
Database changed
mysql> create table nama_buku(kode_buku char(4)primary key not null,judul varcha
r(30)not null,pengarang varchar(30)not null);
Query OK, 0 rows affected (1.67 sec)

mysql> desc nama_buku;
+-----------+-------------+------+-----+---------+-------+
| Field     | Type        | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| kode_buku | char(4)     | NO   | PRI |         |       |
| judul     | varchar(30) | NO   |     |         |       |
| pengarang | varchar(30) | NO   |     |         |       |
+-----------+-------------+------+-----+---------+-------+
3 rows in set (0.06 sec)

mysql> insert into nama_buku values
    -> ('Bo1','delphi','wahyu subuh'),
    -> ('Bo2','java programming','fuad asar'),
    -> ('Bo3','excel','najib magrib'),
    -> ('Bo4','pemprograman web','rohim');
Query OK, 4 rows affected (0.36 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql> select*from nama_buku;
+-----------+------------------+--------------+
| kode_buku | judul            | pengarang    |
+-----------+------------------+--------------+
| Bo1       | delphi           | wahyu subuh  |
| Bo2       | java programming | fuad asar    |
| Bo3       | excel            | najib magrib |
| Bo4       | pemprograman web | rohim        |
+-----------+------------------+--------------+
4 rows in set (0.02 sec)

mysql> update nama_buku set judul='delphi_pemrograman' where kode_buku='Bo1';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select*from nama_buku;
+-----------+--------------------+--------------+
| kode_buku | judul              | pengarang    |
+-----------+--------------------+--------------+
| Bo1       | delphi_pemrograman | wahyu subuh  |
| Bo2       | java programming   | fuad asar    |
| Bo3       | excel              | najib magrib |
| Bo4       | pemprograman web   | rohim        |
+-----------+--------------------+--------------+
4 rows in set (0.00 sec)

mysql> delete from nama_buku where kode_buku='Bo4';
Query OK, 1 row affected (0.01 sec)

mysql> select*from nama_buku;
+-----------+--------------------+--------------+
| kode_buku | judul              | pengarang    |
+-----------+--------------------+--------------+
| Bo1       | delphi_pemrograman | wahyu subuh  |
| Bo2       | java programming   | fuad asar    |
| Bo3       | excel              | najib magrib |
+-----------+--------------------+--------------+
3 rows in set (0.00 sec)

0 komentar:

Posting Komentar

weLcome in my bLog ^_^"

mampir sebentaar yyaa......di bLog ssaiaa......mkaseeeh.....
S.E.L.A.M.A.T__D.A.T.A.N.G
Ada kesalahan di dalam gadget ini

Donald The Duck Virtual Pet

Winnie The Pooh

Ada kesalahan di dalam gadget ini