TAMPILAN ENTITY RELATIONSHIP DIAGRAM(ERD)
TAMPILAN RELASI TABEL DATABASE
MEMBUAT DATABASE
DENGAN PROGRAM MYSQL FRONT 5.5
1.
Perintah Membuat Database praktek_rumah_sakit
mysql> create database praktek_rumah_sakit;
Query OK, 1 row affected (0.01 sec)
|
2.
Perintah Menyeleksi Database praktek_rumah_sakit
mysql> use bima;
Database changed
|
3.
Perintah Membuat Tabel Kelas
mysql> create table kelas
->
(Id_kelas char(10) primary key,
->
nama varchar(20));
Query OK, 0 row affected (0.19
sec)
|
4.
Perintah Membuat Tabel Ruang
mysql> create table ruang
->
(Id_Ruang char(10) primary key,
->
Nama_Ruang varchar(20));
Query OK, 0 row affected (0.39
sec)
|
5.
Perintah Membuat Tabel Dokter
mysql> create table dokter
-> (Id_dokter char(10) primary key,
-> Nama_dokter varchar(20));
Query OK, 0 row affected (0.09
sec)
|
6.
Perintah Membuat Tabel Pasien
mysql> create table pasien
-> (Id_Pasien char(10) primary key,
->
Nama_Pasien varchar(20));
Query OK, 0 row affected (0.38
sec)
|
7.
Perintah Membuat Tabel Praktek
mysql> create table praktek
->
(Id_Praktek char(10) primary key,
->
Id_dokter char(10),
->
foreign key(Id_dokter) references dokter(Id_dokter));
Query OK, 0 row affected (0.11
sec)
|
8.
Perintah Membuat Tabel Rawat_Jalan
mysql> create table rawat_jalan
-> (No_Kartu char(10) primary
key,
->
Id_Pasien char(10),
-> foreign key(Id_Pasien)
references Pasien(Id_Pasien));
Query OK, 0 row affected (0.13
sec)
|
9.
Perintah Membuat Tabel Rawat_Inap
mysql> create table rawat_inap
-> (Kode_Rawat_Inap char(10) primary key,
-> Id_Ruang char(10),
-> Id_Pasien char(10),
-> Id_dokter char(10),
-> Waktu_Masuk char(10),
-> Waktu_keluar char(10),
-> foreign key(Id_Ruang) references ruang(Id_Ruang));
-> foreign key(Id_Pasien)
references Pasien(Id_Pasien));
-> foreign key(Id_dokter)
references dokter(Id_dokter));
Query OK, 0 row affected (0.45
sec)
|
10. Perintah
melihat tabel yang ada di dalam database praktek_rumah_sakit
mysql>
show tables;
+------------------------------------+
| Tables_in_bima_praktek_rumah_sakit | +------------------------------------+ | dokter | | kelas | | pasien | | praktek |
| rawat_inap
|
| rawat_jalan |
| ruang |
-------------------------------------+
7 rows in set (0.01 sec)
|
11. Perintah melihat deskripsi tabel
Dokter
mysql>
desc dokter;
+-------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | +-------------+------------+------+-----+---------+-------+ | Id_dokter |int(11) | NO | PRI |NULL | | | Nama_Dokter |varchar(20) | YES | |NULL | |
--------------+------------+------+-----+---------+-------+
2 rows in set (0.09 sec)
|
12. Perintah
melihat deskripsi tabel Kelas
mysql>
desc kelas;
+----------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | +----------+------------+------+-----+---------+-------+ | Id_kelas |char(10) | NO | PRI |NULL | | | kelas |varchar(20) | YES | |NULL | |
-----------+------------+------+-----+---------+-------+
2 rows in set (0.29 sec)
|
13. Perintah
melihat deskripsi tabel Pasien
mysql>
desc pasien;
+-------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | +-------------+------------+------+-----+---------+-------+ | Id_pasien |char(10) | NO | PRI |NULL | | | Nama_Pasien |varchar(20) | YES | |NULL | |
--------------+------------+------+-----+---------+-------+
2 rows in set (0.06 sec)
|
14. Perintah
melihat deskripsi tabel Praktek
mysql>
desc praktek;
+------------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | +------------+---------+------+-----+---------+-------+ | Id_praktek |char(10) | NO | PRI |NULL | | | Id_dokter |char(10) | YES | MUL |NULL | |
-------------+---------+------+-----+---------+-------+
2 rows in set (0.06 sec)
|
15. Perintah
melihat deskripsi tabel Rawat_Inap
mysql>
desc rawat_inap;
+-----------------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | +-----------------+---------+------+-----+---------+-------+ | Kode_Rawat_Inap |char(10) | NO | PRI |NULL | | | Id_Ruang |char(10) | YES | MUL |NULL | |
| Id_Pasien
|char(10) | YES | MUL |NULL |
|
| Id_dokter |char(10) | YES | MUL |NULL |
|
| Waktu_Masuk |char(10) | YES | |NULL
| |
| Waktu_Keluar
|char(10) | YES |
|NULL | |
------------------+---------+------+-----+---------+-------+
6 rows in set (0.07 sec)
|
16. Perintah
melihat deskripsi tabel Rawat_Jalan
mysql>
desc rawat_jalan;
+-----------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | +-----------+---------+------+-----+---------+-------+ | No_Kartu |char(10) | NO | PRI |NULL | | | Id_Pasien |char(10) | YES | MUL |NULL | |
------------+---------+------+-----+---------+-------+
2 rows in set (0.07 sec)
|
17. Perintah
melihat deskripsi tabel Ruang
mysql>
desc ruang;
+------------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | +------------+-----------+------+-----+---------+-------+ | Id_Ruang |char(10) | NO | PRI |NULL | | | Nama_Ruang |varchar(20)| YES | |NULL | |
-------------+-----------+------+-----+---------+-------+
2 rows in set (0.05 sec)
|
EmoticonEmoticon