Crud Operations in SQL
? CRUD Operations in SQL
CRUD stands for Create, Read, Update, Delete — the four basic operations for managing data in a database.
1. Create (INSERT)
Add new records to a table.
INSERT INTO table_name (column1, column2, ...)VALUES (value1, value2, ...);Example
INSERT INTO employees (id, first_name, last_name, email)VALUES (1, 'John', 'Doe', 'john.doe@example.com');2. Read (SELECT)
Retrieve data from one or more tables.
SELECT column1, column2, ...FROM table_nameWHERE condition;Example
SELECT first_name, last_name, emailFROM employeesWHERE id = 1;3. Update (UPDATE)
Modify existing records.
UPDATE table_nameSET column1 = value1, column2 = value2, ...WHERE condition;Example
UPDATE employeesSET email = 'john.newemail@example.com'WHERE id = 1;4. Delete (DELETE)
Remove records from a table.
DELETE FROM table_nameWHERE condition;Example
DELETE FROM employeesWHERE id = 1;Summary
| Operation | SQL Command | Purpose |
|---|---|---|
| Create | INSERT | Add new data |
| Read | SELECT | Retrieve data |
| Update | UPDATE | Modify existing data |
| Delete | DELETE | Remove data |
If you want, I can provide examples with transactions, batch operations, or advanced filtering!