SQL LEARNING SERIES PART-6
Complete SQL Topics for Data Analysis
-> https://t.me/sqlspecialist/523
Today we will learn about Data Modification:
Let's explore how to modify data within a database using SQL. There are three main operations: INSERT, UPDATE, and DELETE.
#### INSERT Statement:
Adds new rows of data into a table.
INSERT INTO table_name (column1, column2) VALUES (value1, value2);Example:
INSERT INTO employees (first_name, last_name, department) VALUES ('John', 'Doe', 'HR');
#### UPDATE Statement:Modifies existing data in a table.
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;Example:
UPDATE employees SET department = 'Finance' WHERE last_name = 'Doe';#### DELETE Statement:
Removes rows from a table based on a condition.
DELETE FROM table_name WHERE condition;Example:
DELETE FROM employees WHERE last_name = 'Doe';Ensure caution when performing UPDATE and DELETE operations to avoid unintended consequences.
This is a bit tricky but important concept.
Share with credits: https://t.me/sqlspecialist
Hope it helps :)