Database Languages – DML (Data Manipulation Language)
Includes Oracle SQL examples for INSERT, UPDATE, DELETE, and SELECT operations.
DML is a set of SQL commands used to manipulate data stored in the database. Unlike DDL, which defines structure, DML operates on the data inside tables.
1. What is DML?
- Allows adding, updating, deleting, and retrieving data.
- Changes are transactional and can be rolled back.
- Requires proper privileges: INSERT, UPDATE, DELETE, SELECT.
2. Common DML Commands
| Command | Purpose | Oracle Example |
|---|---|---|
| INSERT | Add new rows | INSERT INTO student VALUES (101, 'Ahsan', 'DBMS'); |
| UPDATE | Modify existing rows | UPDATE student SET course='AI' WHERE student_id=101; |
| DELETE | Remove rows | DELETE FROM student WHERE student_id=101; |
| SELECT | Retrieve data | SELECT * FROM student; |
3. Oracle Examples in Detail
INSERT Example
INSERT INTO employee (emp_id, emp_name, dept_id) VALUES (101, 'Ahsan', 10);
UPDATE Example
UPDATE employee SET emp_name = 'Ahsan Arif', dept_id = 20 WHERE emp_id = 101;
DELETE Example
DELETE FROM employee WHERE emp_id = 101;
SELECT Example
SELECT emp_id, emp_name, dept_id FROM employee WHERE dept_id = 20;
4. Key Points
- DML commands manipulate data only, not structure.
- Changes can be committed or rolled back.
- Proper privileges are required for all operations.
5. Summary
DML (Data Manipulation Language) is essential for working with table data. Commands include INSERT, UPDATE, DELETE, SELECT. Supports transactions to ensure data integrity.
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন