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!
π» 3. DELETE (Remove Data) βΒΆ
Warning: This is permanent!
ποΈ 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.