Relation between a database is sometimes required to present an amalgamation of information in one table. For example, when it will make a report values for which data from several tables, and it is impossible and inefficient if it is made a new table to input their own values that should be derived from other tables.
Examples of application relation table:
- make a your own database (“db_student”).
- next, make table in database : (in the table “dosen” who became the primary key is a nip, and in the table “mahasiswa” who became the primary key is a nrp, and in the table “matakuliah” who became the primary key is a kode, and the last table “nilai” there is no primary key.
- fill of each table with a value.
- After finish all entry in table, now return to database and click SQL menu, and write this script :
create view LaporanNilai as select mahasiswa.nrp, mahasiswa.nama, mahasiswa.jurusan, matakuliah.matakuliah, dosen.dosen, nilai.nilai, nilai.mutu from mahasiswa, matakuliah, dosen, nilai where nilai.nrp=mahasiswa.nrp and nilai.kode=matakuliah.kode and nilai.nip=dosen.nip;
- After finish and executed, it will be formed a view table and show a result from a relationships table.