Membuat view

TUGAS 6
MANAJEMEN BASIS DATA
"Membuat View"




Disusun Oleh :
INGGIT NADYA NASTITI
160101243






STMIK DUTA BANGSA SURAKARTA
2018
______________________________________________

1. Membuat view

mysql> create view vnilaimhs as
    -> select a.nrp, a.nama, b.nama_mk,B.sks,c.nilai from mahasiswa a, mtkuliah b,
nilaimhs c where  a.nrp=c.nrp and b.kode_mk=c.kode_mk;
Query OK, 0 rows affected

2. Menampilkan view
mysql> select * from vnilaimhs;
+-----------+-----------+---------------+-----+-------+
| nrp       | nama      | nama_mk       | sks | nilai |
+-----------+-----------+---------------+-----+-------+
| 120101001 | Anto Budi | Pemrograman 1 |   3 |    70 |
| 120101001 | Anto Budi | Basis Data 1  |   3 |    80 |
| 120101001 | Anto Budi | Manajemen     |   2 |    85 |
| 120101001 | Anto Budi | Algoritma     |   3 |    78 |
| 120101001 | Anto Budi | Agama         |   2 |    80 |
| 120101002 | Sugiyarto | Pemrograman 1 |   3 |    70 |
| 120101002 | Sugiyarto | Basis Data 1  |   3 |    70 |
| 120101002 | Sugiyarto | Manajemen     |   2 |    75 |
| 120101002 | Sugiyarto | Algoritma     |   3 |    80 |
| 120101002 | Sugiyarto | Agama         |   2 |    80 |
| 120101003 | Sumini    | Pemrograman 1 |   3 |    80 |
| 120101003 | Sumini    | Basis Data 1  |   3 |    70 |
| 120101003 | Sumini    | Manajemen     |   2 |    65 |
| 120101003 | Sumini    | Algoritma     |   3 |    70 |
| 120101003 | Sumini    | Agama         |   2 |    70 |
| 120101004 | yuni      | Pemrograman 1 |   3 |    90 |
| 120101004 | yuni      | Basis Data 1  |   3 |    75 |
| 120101004 | yuni      | Manajemen     |   2 |    75 |
| 120101004 | yuni      | Algoritma     |   3 |    80 |
| 120101004 | yuni      | Agama         |   2 |    80 |
+-----------+-----------+---------------+-----+-------+
20 rows in set


3. Menampilkan view (hanya mata kuliah "Basis Data 1")
mysql> select nrp, nama,nama_mk,sks, nilai from vnilaimhs where nama_mk=
'Basis Data 1';
+-----------+-----------+--------------+-----+-------+
| nrp       | nama      | nama_mk      | sks | nilai |
+-----------+-----------+--------------+-----+-------+
| 120101001 | Anto Budi | Basis Data 1 |   3 |    80 |
| 120101002 | Sugiyarto | Basis Data 1 |   3 |    70 |
| 120101003 | Sumini    | Basis Data 1 |   3 |    70 |
| 120101004 | yuni      | Basis Data 1 |   3 |    75 |
+-----------+-----------+--------------+-----+-------+
4 rows in set

4. Menampilkan view (hanya nim "120101004")
mysql> select nrp, nama,nama_mk,sks, nilai from vnilaimhs where nrp='120101004';
+-----------+------+---------------+-----+-------+
| nrp       | nama | nama_mk       | sks | nilai |
+-----------+------+---------------+-----+-------+
| 120101004 | yuni | Pemrograman 1 |   3 |    90 |
| 120101004 | yuni | Basis Data 1  |   3 |    75 |
| 120101004 | yuni | Manajemen     |   2 |    75 |
| 120101004 | yuni | Algoritma     |   3 |    80 |
| 120101004 | yuni | Agama         |   2 |    80 |
+-----------+------+---------------+-----+-------+
5 rows in set


TERIMAKASIH
                                                                                       

Komentar

Postingan populer dari blog ini

Faktor Penyebab Pelanggaran Kode Etik Profesi IT

FITUR - FITUR DISTRO TURUNAN DEBIAN

Kesadaran Hukum