CREATE TABLE employees (
id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(50),
last_name VARCHAR(50),
age INT,
department VARCHAR(50)
);
2. Insert sample data into the employees table:
INSERT INTO employees (first_name, last_name, age, department)
VALUES
('John', 'Doe', 30, 'Engineering'),
('Jane', 'Smith', 28, 'Marketing'),
('Alice', 'Johnson', 35, 'HR'),
('Bob', 'Brown', 40, 'Finance');
3. Delete data from the employees table:
Delete John Doe's record:
DELETE FROM employees
WHERE first_name = 'John' AND last_name = 'Doe';
Delete all employees older than 60 years:
DELETE FROM employees
WHERE age > 60;
Delete all records:
DELETE FROM employees;
This covers the basics of the DELETE statement in SQL. By following these examples, you can efficiently delete data from your database tables.