Data manipulation operations
📌 What is Data Manipulation?
Data Manipulation refers to the process of inserting, updating, retrieving, and deleting data in a relational database. In SQL, these operations are part of DML (Data Manipulation Language) commands, which operate on the data stored within the database tables.
🔑 Key Data Manipulation Operations (DML Commands)
Operation
SQL Command Used
Purpose
Insert Data
INSERT INTO
Add new records to a table
Retrieve Data
SELECT
Query and fetch records from a table
Update Data
UPDATE
Modify existing records in a table
Delete Data
DELETE FROM
Remove records from a table
✅ Detailed Overview of Each Operation
1. INSERT INTO - Add New Records
Purpose: Insert new data rows into a table.
Syntax:
Example:
2. SELECT - Retrieve Data
Purpose: Retrieve data from one or more tables.
Syntax:
Example:
Fetch all columns:
3. UPDATE - Modify Existing Records
Purpose: Update existing data in a table.
Syntax:
Example:
⚠️ Note: Always use
WHERE
to target specific records and avoid updating the entire table.
4. DELETE FROM - Remove Records
Purpose: Delete records from a table.
Syntax:
Example:
⚠️ Warning: Without
WHERE
, all records in the table will be deleted:
🔍 Additional Data Manipulation Concepts
✅ Filtering Data (WHERE Clause)
✅ Sorting Data (ORDER BY Clause)
✅ Limiting Results (LIMIT Clause - MySQL, PostgreSQL)
✅ Aggregating Data (GROUP BY and Aggregate Functions)
✅ Joining Data from Multiple Tables (JOINs)
📊 Example Table: employees
employees
1
John Doe
28
Developer
60000
2
Jane Smith
32
Manager
75000
3
Alice Johnson
30
Data Analyst
50000
DML Task
SQL Example
Add a new employee
INSERT INTO employees (name, age, position, salary) VALUES ('Bob Martin', 29, 'Tester', 45000);
Get all managers
SELECT * FROM employees WHERE position = 'Manager';
Increase salary
UPDATE employees SET salary = 80000 WHERE name = 'Jane Smith';
Remove an employee
DELETE FROM employees WHERE id = 3;
🎯 Why Data Manipulation is Important for Business Analysts
Reason
Explanation
Access and Analyze Data
Retrieve data to generate reports and insights.
Validate Requirements
Check existing data to ensure system compliance.
Support Testing and QA
Create and manipulate test data.
Facilitate Decision Making
Provide accurate data for strategic decisions.
🚀 Conclusion
CRUD Operations form the foundation of interacting with relational databases.
Knowing DML commands helps Business Analysts work effectively with technical teams.
Essential for data analysis, system understanding, and requirement validation.
Last updated