Pengolahan Basis Data Lanjut – Pembuatan View dan Relasi Tabel

Perintah Select In:

Select nim,nama from mahasiswa where kodeprodi=’55201’ and nim in(select nim from studimhs where thajaran=’20112’);

Perintah Join:

Select mahasiswa.nim, nama from mahasiswa inner join studimhs on mahasiswa.nim =studimhs.nim where studimhs.thajaran=20112 and mahasiswa.kodeprodi=55201;

Membuat VIEW : membuat view mahasiswa prodi TI

  1. mysql> select nim from mahasiswa where kodeprodi=’55201′;
  2. mysql> create view mhs_ti as select nim from mahasiswa where kodeprodi=’55201′;
  3. mysql> create view id_krs as select idkrs from studimhs where nim=’12111089′;
  4. mysql> select kodemk, (select namamk from matakuliah where kodemk=nilai.kodemk) from nilai where idkrs in(select * from id_krs);

Menghapus View:

mysql> drop view id_krs;

Backup Database:

D:\wamp\mysql\bin>mysqldump -u root akademik12111089 > g:\backup_akademik.sql

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s