Senin, 21 Mei 2012

Contoh Database Karyawan Database Oracle

Enter password: ****

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

Your MySQL connection id is 10

Server version: 6.0.4-alpha-community-log MySQL Community Server (GPL)


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


mysql> create database karyawan;

Query OK, 1 row affected (0.02 sec)


mysql> use karyawan;

Database changed

mysql> create table karyawan(

    -> nik int (10) primary key,

    -> nama varchar (15),

    -> alamat varchar (20),

    -> jabatan varchar (10));

Query OK, 0 rows affected (0.25 sec)


mysql> show tables;

+--------------------+

| Tables_in_karyawan |

+--------------------+

| karyawan           |

+--------------------+

1 row in set (0.13 sec)


mysql> desc karyawan;

+---------+-------------+------+-----+---------+-------+

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

+---------+-------------+------+-----+---------+-------+

| nik     | int(10)     | NO   | PRI | NULL    |       |

| nama    | varchar(15) | YES  |     | NULL    |       |

| alamat  | varchar(20) | YES  |     | NULL    |       |

| jabatan | varchar(10) | YES  |     | NULL    |       |

+---------+-------------+------+-----+---------+-------+

4 rows in set (0.17 sec)


mysql> insert into karyawan value('1112','jefrey','medan','MANAGER');

Query OK, 1 row affected (0.08 sec)


mysql> show tables;

+--------------------+

| Tables_in_karyawan |

+--------------------+

| karyawan           |

+--------------------+

1 row in set (0.00 sec)


mysql> select*from karyawan;

+------+--------+--------+---------+

| nik  | nama   | alamat | jabatan |

+------+--------+--------+---------+

| 1112 | bambang | medan  | MANAGER |

+------+--------+--------+---------+

1 row in set (0.00 sec)


mysql> insert into karyawan value('1113','dian','siantar','HEADSERVICE');

Query OK, 1 row affected, 1 warning (0.04 sec)


mysql> select*from karyawan;

+------+--------+---------+------------+

| nik  | nama   | alamat  | jabatan    |

+------+--------+---------+------------+

| 1112 | bambang | medan   | MANAGER    |

| 1113 | dian   | siantar | HEADSERVIC |

+------+--------+---------+------------+

2 rows in set (0.00 sec)

mysql> insert into karyawan value('1114','praja','banjarmasin','MEKANIK');

Query OK, 1 row affected (0.00 sec)


mysql> select*from karyawan;

+------+--------+-------------+------------+

| nik  | nama   | alamat      | jabatan    |

+------+--------+-------------+------------+

| 1112 | bambang | medan       | MANAGER    |

| 1113 | dian   | siantar     | HEADSERVIC |

| 1114 | praja  | banjarmasin | MEKANIK    |

+------+--------+-------------+------------+

3 rows in set (0.00 sec)


mysql>

Tidak ada komentar:

Poskan Komentar