latihan DML2.1

JOIN dan KUNCI
Sintaks :
                SELECT table_mahasiswsa.Nama_Depan
                FROM table_mahasiswsa, tabel_jurursan
                WHERE table_mahasiswsa.kode_jurusan = tabel_jurursan.kode_jurusan
                AND tabel_jurusan.nama_jurusan = “Teknik Informatika”


INNER JOIN
Sintaks :
                SELECT table_mahasiswsa.Nama_Depan, tabel_jurursan.nama_jurusan
                FROM table_mahasiswsa INNER JOIN tabel_jurursan
                ON table_mahasiswsa.kode_jurusan = tabel_jujursan.kode_jurusan

LEFT JOIN
Sintaks :
                SELECT table_mahasiswsa.Nama_Depan, tabel_jujursan.nama_jurusan
                FROM table_mahasiswsa LEFT JOIN tabel_jujursan
                ON table_mahasiswsa.kode_jurusan = tabel_jujursan.kode_jurusan

RIGHT JOIN
Sintaks :
                SELECT table_mahasiswsa.Nama_Depan, tabel_jujursan.nama_jurusan
                FROM table_mahasiswsa RIGHT JOIN tabel_jujursan
                ON table_mahasiswsa.kode_jurusan = tabel_jujursan.kode_jurusan

UNION
Sintaks :
                SELECT nama_depan FROM table_mahasiswsa
                UNION
    SELECT nama_depan FROM table_mahasiswsa

UNION ALL
Sintaks :
                SELECT nama_depan FROM table_mahasiswsa
                UNION ALL
                SELECT nama_depan FROM table_mahasiswsa

OPERATOR ANY
Sintaks :
SELECT * FROM tabel_matakuliah
WHERE SKS > ANY (SELECT SKS FROM tabel_matakuliah)

OPERATOR ALL
Sintaks :
SELECT * FROM tabel_matakuliah
WHERE SKS > ANY (SELECT SKS FROM tabel_matakuliah)

UNION
Sintaks :
                SELECT nama_depan, tempat_lahir
                FROM table_mahasiswsa
                WHERE tempat_lahir = “kebumen”
                UNION
                SELECT nama_depan, tempat_lahir
                FROM table_mahasiswsa
                WHERE tempat_lahir = “klaten”


INTERSECT
Sintaks :
                SELECT * FROM table_mahasiswsa
                INTERSECT
                SELECT * FROM table_mahasiswsa


EXCEPT
Sintaks :
                SELECT * FROM table_mahasiswsa
                INTERSECT
                SELECT * FROM table_mahasiswsa

Komentar

Postingan Populer