Skip to content

Oracle DML Basics πŸ“ΒΆ

Prerequisites: SELECT Statement, Table Management

Mentor's Note: Creating the table was building the room. DML is the act of moving furniture in, rearranging it, or throwing it away. But remember: in Oracle, changes aren't permanent until you say so! πŸ’‘


🌟 The Scenario: The Office Move πŸ“¦ΒΆ

  • INSERT: Bringing a new desk into the room.
  • UPDATE: Changing the label on a folder.
  • DELETE: Removing an old chair that broke.

πŸ’» 1. INSERT (Add Data)ΒΆ

-- Standard Insert
INSERT INTO employees (id, name, salary)
VALUES (101, 'Rahul', 50000);

-- Bulk Insert from another table
INSERT INTO graduates_archive
SELECT * FROM students WHERE status = 'Finished';

πŸ’» 2. UPDATE (Modify Data) ✏️¢

Warning: Always use a WHERE clause!

UPDATE employees
SET salary = salary * 1.10 -- 10% raise
WHERE department_id = 20;

πŸ’» 3. DELETE (Remove Data) ❌¢

Warning: This is permanent!

DELETE FROM employees
WHERE id = 105;

πŸ—οΈ Architect's Note: Transactions & Redo Logs πŸ›‘οΈΒΆ

Oracle is a Transactional database. - The Architect's Secret: When you run DML, Oracle doesn't change the data on the disk immediately. It writes to the Redo Log first. - The Safety Net: Use COMMIT to save permanently or ROLLBACK to undo your mistakes! - Architecture Tip: Keep your transactions short. Long transactions hold "Locks" on the rows, which can slow down other users.


πŸ“ˆ Learning PathΒΆ