Selasa, 24 April 2018

Create View MySQL Query (Tugas 6 Manajemen dan Administrasi Basis Data)

TUGAS 6 MANAJEMEN DAN ADMINISTRASI BASIS DATA

Dosen Pengampu: Bp. Eko Purwanto




                                                        NAMA : Eko Pranoto Saputro

                                                        NIM     : 160101237

                                                        Smt      : 4 (empat) 



STMIK DUTA BANGSA SURAKARTA
2018

========================================================================





mysql> use ekopranotosaputro;
Database changed
mysql> create view soal1 as
    -> select a.nrp,a.nama,b.nama_mk,b.sks,c.nilai from nilaimhs c 
join mahasiswa a on c.nrp=a.nrp join mtkuliah b on c.kode_mk=b.kode_mk;
Query OK, 0 rows affected

mysql> select * from soal1;
+-----------+-----------+--------------+-----+-------+
| nrp       | nama      | nama_mk      | sks | nilai |
+-----------+-----------+--------------+-----+-------+
| 120101001 | Anto Budi | Pemograman 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 | Pemograman 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    | Pemograman 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      | Pemograman 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

mysql> create view soal2 as
    -> select a.nrp,a.nama,b.nama_mk,b.sks,c.nilai from nilaimhs c 
join mahasiswa a on c.nrp=a.nrp join mtkuliah b on c.kode_mk=b.kode_mk where b.nama_mk='Basis Data 1';
Query OK, 0 rows affected

mysql> select * from soal2;
+-----------+-----------+--------------+-----+-------+
| 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

mysql> create view soal3 as
    -> select a.nrp,a.nama,b.nama_mk,b.sks,c.nilai from nilaimhs c 
join mahasiswa a on c.nrp=a.nrp join mtkuliah b on c.kode_mk=b.kode_mk where a.nrp='120101004';
Query OK, 0 rows affected

mysql> select * from soal3;
+-----------+------+--------------+-----+-------+
| nrp       | nama | nama_mk      | sks | nilai |
+-----------+------+--------------+-----+-------+
| 120101004 | yuni | Pemograman 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

mysql> 

Tidak ada komentar:

Posting Komentar