Difference Between DELETE, TRUNCATE and DROP Command in SQL | DELETE vs TRUNCATE vs DROP

preview_player
Показать описание
Learn the key differences between DELETE, DROP, and TRUNCATE commands in SQL for managing data in databases, including their use cases and examples.

Script -- Create the employees table
CREATE TABLE employees (
employee_id INT PRIMARY KEY,
name VARCHAR(50),
department VARCHAR(50),
salary DECIMAL(10, 2)
);

-- Insert data into the employees table
INSERT INTO employees (employee_id, name, department, salary) VALUES
(1, 'Alice', 'HR', 5000),
(2, 'Bob', 'Finance', 6000),
(3, 'Charlie', 'IT', 7000),
(4, 'David', 'Marketing', 5500),
(5, 'Emma', 'IT', 6500);

#sqlinterview #sqlqueryinterviewquestionsandanswers #sqlforbeginners #sqlinterviewquestions #dataengineer #dataanalysis #interviewquestion #sqlinterview #sqlinterviewquestions
Рекомендации по теме
Комментарии
Автор

Simple, clear and to the point explanation

Автор

So after truncating, no rollback possible.🤔

echodelta