DML (Data Manipulation Language) merupakan bahasa basis data yang berguna untuk melakukan proses modifikasi dan pengambilan data pada suatu basis data. Modifikasi yang dapat dilakukan adalah penambahan (insert), pembaharuan (update), penghapusan (delete).
o Insert Baris dalam Tabel INSERT INTO (, … , ) VALUES (, … , ); INSERT INTO departments(department_id, department_name, manager_id, location_id) VALUES (70, ‘Public Relations’, 100, 1700); o Insert Baris dengan Nilai NULL INSERT INTO VALUES (, … , , NULL); INSERT INTO departments VALUES (100, ‘Finance’, NULL, NULL); o Insert Baris berdasarkan Tabel Lain INSERT INTO (, … , ) [Syntax Query SQL]; INSERT INTO sales_reps(id, name, salary, commission_pct) SELECT employee_id, last_name, salary, commission_pct FROM employees WHERE job_id LIKE ‘%REP%’; o Update Baris dalam Tabel UPDATE SET = [WHERE condition]; UPDATE employees SET department_id = 70 WHERE employee_id = 113; o Update 2 Kolom dengan Sub-Query UPDATE SET = ([Syntax Query SQL]); UPDATE employees SET job_id = (SELECT job_id FROM employees WHERE employee_id = 205); o Delete Baris dalam Tabel DELETE FROM WHERE = ; DELETE FROM departments WHERE department_name = ‘Finance’; o Delete Baris berdasarkan Tabel Lain DELETE WHERE = ([Syntax Query SQL]); DELETE FROM employees WHERE department_id = (SELECT department_id FROM departments WHERE department_name LIKE ‘%Public%’); o Select Query SELECT FROM [WHERE ] [GROUP BY ] [HAVING ] [ORDER BY ]
Tidak ada komentar:
Posting Komentar