MENCOBA BELAJAR BASIS DATA
-> from mahasiswa, dosen, ambil, makul
-> where mahasiswa.nip=dosen.nip and mahasiswa.nim=ambil.nim and makul.kd_mk
=makul.kd_mk and makul.nm_mk='Kalkulus Lanjut';
+----------+-----------+-------------+-------+
| nim | nama | nama | nilai |
+----------+-----------+-------------+-------+
| 05018001 | Ine | Doni, S.T | 100 |
| 05018001 | Ine | Doni, S.T | 85 |
| 05018001 | Ine | Doni, S.T | 75 |
| 05018002 | Isna | Shinta, S.T | 85 |
| 05018002 | Isna | Shinta, S.T | 100 |
+----------+-----------+-------------+-------+
5 rows in set (0.37 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama, ambil.nilai
-> from mahasiswa, dosen, ambil, makul
-> where mahasiswa.nip=dosen.nip and mahasiswa.nim=ambil.nim and makul.kd_mk
=makul.kd_mk and makul.nm_mk='Kalkulus Lanjut' group by mahasiswa.nim;
+----------+-----------+-------------+-------+
| nim | nama | nama | nilai |
+----------+-----------+-------------+-------+
| 05018001 | Ine | Doni, S.T | 100 |
| 05018002 | Isna | Shinta, S.T | 85 |
+----------+-----------+-------------+-------+
2 rows in set (0.05 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama
-> from mahasiswa, dosen
-> where mahasiswa.nip=dosen.nip and mahasiswa.nim=(
-> select ambil.nim from ambil, makul where ambil.kd_mk=makul.kd_mk and
-> makul.nm_mk='Kalkulus Lanjut');
+----------+-----------+-----------+
| nim | nama | nama |
+----------+-----------+-----------+
| 05018001 | Ine | Doni, S.T |
+----------+-----------+-----------+
1 row in set (0.07 sec)
mysql> select * from ambil;
+----------+----------+-------+-------+
| nim | kd_mk | nilai | kelas |
+----------+----------+-------+-------+
| 05018001 | T0000001 | 100 | A |
| 05018001 | T0000002 | 85 | A |
| 05018001 | T0000003 | 75 | A |
| 05018002 | T0000001 | 85 | A |
| 05018002 | T0000003 | 100 | A |
+----------+----------+-------+-------+
5 rows in set (0.00 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama
-> from mahasiswa, dosen
-> where mahasiswa.nip=dosen.nip and mahasiswa.nim in
-> (select ambil.nim from ambil, makul where ambil.kd_mk=makul.kd_mk and
-> makul.nm_mk='Kalkulus Lanjut');
+----------+-----------+-----------+
| nim | nama | nama |
+----------+-----------+-----------+
| 05018001 | Ine | Doni, S.T |
+----------+-----------+-----------+
1 row in set (0.04 sec)
mysql> select ambil.nim from ambil, makul where ambil.kd_mk=makul.kd_mk and
-> makul.nm_mk='Kalkulus Lanjut';
+----------+
| nim |
+----------+
| 05018001 |
+----------+
1 row in set (0.00 sec)
mysql> select * from makul;
+----------+--------------------+-----+
| kd_mk | nm_mk | sks |
+----------+--------------------+-----+
| T0000001 | Matematika Diskrit | 3 |
| T0000002 | Kalkulus Lanjut | 3 |
| T0000003 | Basis Data | 3 |
+----------+--------------------+-----+
3 rows in set (0.00 sec)
mysql> select * from ambil;
+----------+----------+-------+-------+
| nim | kd_mk | nilai | kelas |
+----------+----------+-------+-------+
| 05018001 | T0000001 | 100 | A |
| 05018001 | T0000002 | 85 | A |
| 05018001 | T0000003 | 75 | A |
| 05018002 | T0000001 | 85 | A |
| 05018002 | T0000003 | 100 | A |
+----------+----------+-------+-------+
5 rows in set (0.00 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama, ambil.nilai
-> from mahasiswa, dosen, ambil, makul
-> where dosen.nip=mahasiswa.nip and mahasiswa.nim=ambil.nim and makul.kd_mk
=makul.kd_mk and makul.nm_mk='Kalkulus Lanjut';
+----------+-----------+-------------+-------+
| nim | nama | nama | nilai |
+----------+-----------+-------------+-------+
| 05018001 | Ine | Doni, S.T | 100 |
| 05018001 | Ine | Doni, S.T | 85 |
| 05018001 | Ine | Doni, S.T | 75 |
| 05018002 | Isna | Shinta, S.T | 85 |
| 05018002 | Isna | Shinta, S.T | 100 |
+----------+-----------+-------------+-------+
5 rows in set (0.00 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama, ambil.nilai
-> from mahasiswa, dosen, ambil, makul
-> where dosen.nip=mahasiswa.nip and mahasiswa.nim=ambil.nim and makul.kd_mk
=ambil.kd_mk and makul.nm_mk='Kalkulus Lanjut';
+----------+-----------+-----------+-------+
| nim | nama | nama | nilai |
+----------+-----------+-----------+-------+
| 05018001 | Ine | Doni, S.T | 85 |
+----------+-----------+-----------+-------+
1 row in set (0.04 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama, ambil.nilai
-> from mahasiswa, dosen, ambil
-> where dosen.nip=mahasiswa.nip and mahasiswa.nim=ambil.nim and mahasiswa.n
im in (select ambil.nim from ambil,makul where ambil.kd_mk=makul.kd_mk and makul
.nm_mk='Kalkulus Lanjut');
+----------+-----------+-----------+-------+
| nim | nama | nama | nilai |
+----------+-----------+-----------+-------+
| 05018001 | Ine | Doni, S.T | 100 |
| 05018001 | Ine | Doni, S.T | 85 |
| 05018001 | Ine | Doni, S.T | 75 |
+----------+-----------+-----------+-------+
3 rows in set (0.00 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama, ambil.nilai
-> from mahasiswa, dosen, ambil
-> where dosen.nip=mahasiswa.nip and mahasiswa.nim=ambil.nim and mahasiswa.n
im in (select ambil.nim from ambil,makul where ambil.kd_mk=makul.kd_mk and makul
.nm_mk='Kalkulus Lanjut') group by mahasiswa.nim;
+----------+-----------+-----------+-------+
| nim | nama | nama | nilai |
+----------+-----------+-----------+-------+
| 05018001 | Ine | Doni, S.T | 100 |
+----------+-----------+-----------+-------+
1 row in set (0.00 sec)
mysql> select ambil.nim from ambil,makul where ambil.kd_mk=makul.kd_mk and makul
.nm_mk='Kalkulus Lanjut';
+----------+
| nim |
+----------+
| 05018001 |
+----------+
1 row in set (0.00 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama, ambil.nilai
-> from mahasiswa, dosen, ambil
-> where dosen.nip=mahasiswa.nip and mahasiswa.nim=ambil.nim and mahasiswa.n
im=(select ambil.nim from ambil,makul where ambil.kd_mk=makul.kd_mk and makul.nm
_mk='Kalkulus Lanjut') group by mahasiswa.nim;
+----------+-----------+-----------+-------+
| nim | nama | nama | nilai |
+----------+-----------+-----------+-------+
| 05018001 | Ine | Doni, S.T | 100 |
+----------+-----------+-----------+-------+
1 row in set (0.01 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama
-> from mahasiswa, dosen, ambil
-> where dosen.nip=mahasiswa.nip and mahasiswa.nim=ambil.nim and mahasiswa.n
im in (select ambil.nim from ambil,makul where ambil.kd_mk=makul.kd_mk and makul
.nm_mk='Kalkulus Lanjut');
+----------+-----------+-----------+
| nim | nama | nama |
+----------+-----------+-----------+
| 05018001 | Ine | Doni, S.T |
| 05018001 | Ine | Doni, S.T |
| 05018001 | Ine | Doni, S.T |
+----------+-----------+-----------+
3 rows in set (0.00 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama, ambil.nilai
-> from mahasiswa, dosen, ambil, makul
-> where dosen.nip=mahasiswa.nip and mahasiswa.nim=ambil.nim and makul.kd_mk
=ambil.kd_mk and makul.nm_mk='Kalkulus Lanjut';
+----------+-----------+-----------+-------+
| nim | nama | nama | nilai |
+----------+-----------+-----------+-------+
| 05018001 | Ine | Doni, S.T | 85 |
+----------+-----------+-----------+-------+
1 row in set (0.00 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama
-> from mahasiswa, dosen
-> where dosen.nip=mahasiswa.nip and mahasiswa.nim in (select ambil.nim from
ambil,makul where ambil.kd_mk=makul.kd_mk and makul.nm_mk='Kalkulus Lanjut');
+----------+-----------+-----------+
| nim | nama | nama |
+----------+-----------+-----------+
| 05018001 | Ine | Doni, S.T |
+----------+-----------+-----------+
1 row in set (0.00 sec)
mysql> select nim, nama from mahasiswa where nim in (
-> select ambil.nim from ambil, makul where ambil.kd_mk=makul.kd_mk and maku
l.nm_mk='Kalkulus Lanjut');
+----------+-----------+
| nim | nama |
+----------+-----------+
| 05018001 | Ine |
+----------+-----------+
1 row in set (0.00 sec)
mysql> select * from ambil;
+----------+----------+-------+-------+
| nim | kd_mk | nilai | kelas |
+----------+----------+-------+-------+
| 05018001 | T0000001 | 100 | A |
| 05018001 | T0000002 | 85 | A |
| 05018001 | T0000003 | 75 | A |
| 05018002 | T0000001 | 85 | A |
| 05018002 | T0000003 | 100 | A |
+----------+----------+-------+-------+
5 rows in set (0.00 sec)
mysql> select * from makul;
+----------+--------------------+-----+
| kd_mk | nm_mk | sks |
+----------+--------------------+-----+
| T0000001 | Matematika Diskrit | 3 |
| T0000002 | Kalkulus Lanjut | 3 |
| T0000003 | Basis Data | 3 |
+----------+--------------------+-----+
3 rows in set (0.00 sec)
mysql> select max(ambil.nilai) from ambil, makul where ambil.kd_mk=makul.kd_mk a
nd makul.nm_mk='Matematika Diskrit';
+------------------+
| max(ambil.nilai) |
+------------------+
| 100 |
+------------------+
1 row in set (0.04 sec)
mysql> select mahasiswa.nim,mahasiswa.nama from mahasiswa,ambil,makul where
-> mahasiswa.nim=ambil.nim and ambil.kd_mk=makul.kd_mk and makul.nm_mk='Mate
matika Diskrit';
+----------+-----------+
| nim | nama |
+----------+-----------+
| 05018001 | Ine |
| 05018002 | Isna |
+----------+-----------+
2 rows in set (0.00 sec)
mysql> select mahasiswa.nim,mahasiswa.nama from mahasiswa,ambil,makul where
-> mahasiswa.nim=ambil.nim and ambil.kd_mk=makul.kd_mk and makul.nm_mk='Mate
matika Diskrit' and ambil.nilai=(
-> select max(ambil.nilai) from ambil, makul where ambil.kd_mk=makul.kd_mk a
nd makul.nm_mk='Matematika Diskrit');
+----------+-----------+
| nim | nama |
+----------+-----------+
| 05018001 | Ine |
+----------+-----------+
1 row in set (0.00 sec)
mysql> select mahasiswa.nim,mahasiswa.nama from mahasiswa,ambil,makul where
-> mahasiswa.nim=ambil.nim and ambil.kd_mk=makul.kd_mk and makul.nm_mk='Mate
matika Diskrit' and ambil.nilai in (
-> select max(ambil.nilai) from ambil, makul where ambil.kd_mk=makul.kd_mk a
nd makul.nm_mk='Matematika Diskrit');
+----------+-----------+
| nim | nama |
+----------+-----------+
| 05018001 | Ine |
+----------+-----------+
1 row in set (0.00 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama from mahasiswa,ambil,mak
ul,dosen where
-> mahasiswa.nim=ambil.nim and mahasiswa.nip=dosen.nip and ambil.kd_mk=maku
l.kd_mk and makul.nm_mk='Matematika Diskrit' and ambil.nilai in (
-> select min(ambil.nilai) from ambil, makul where ambil.kd_mk=makul.kd_mk a
nd makul.nm_mk='Matematika Diskrit');
+----------+------+-------------+
| nim | nama | nama |
+----------+------+-------------+
| 05018002 | Isna | Shinta, S.T |
+----------+------+-------------+
1 row in set (0.01 sec)
mysql> select mahasiswa.nim, mahasiswa.nama, dosen.nama from mahasiswa,ambil,mak
ul,dosen where
-> mahasiswa.nim=ambil.nim and mahasiswa.nip=dosen.nip and ambil.kd_mk=makul
.kd_mk and makul.nm_mk='Kalkulus Lanjut' and mahasiswa.nim not in (
-> select ambil.nim from ambil, makul where ambil.kd_mk=makul.kd_mk and maku
l.nm_mk='Kalkulus Lanjut');
Empty set (0.00 sec)
mysql> iulect ambil.nim from ambil, makul where ambil.kd_mk=makul.kd
0 komentar:
Posting Komentar