Minggu, 02 Desember 2012

belajar singkat DataBase

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Hafiz>cd\

C:\>apache\mysql\bin\
'apache\mysql\bin\' is not recognized as an internal or external command,
operable program or batch file.

C:\>apache\mysql\bin\mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.47-nt

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

mysql> show databases;
+----------+
| Database |
+----------+
| cobaku   |
| mysql    |
| test     |
+----------+
3 rows in set (0.00 sec)

mysql> use cobaku;
Database changed
mysql> show tables;
+------------------+
| Tables_in_cobaku |
+------------------+
| slipknot         |
+------------------+
1 row in set (0.00 sec)

mysql> desc slipknot;
+---------------+----------+------+-----+---------+-------+
| Field         | Type     | Null | Key | Default | Extra |
+---------------+----------+------+-----+---------+-------+
| Nama          | char(30) | YES  |     | NULL    |       |
| alamat        | char(30) | YES  |     | NULL    |       |
| tempat_lahir  | char(30) | YES  |     | NULL    |       |
| tanggal_lahir | date     | YES  |     | NULL    |       |
+---------------+----------+------+-----+---------+-------+
4 rows in set (0.00 sec)

mysql>

$perintah="select kd_brg,nama_brg,harga*jumlah,as total from barang";
as=berguna untuk menambah dan menyisipkan..