In this video, you’ll learn how to use the INSERT INTO ... SELECT statement in MySQL to copy data from one table to another efficiently. This is a powerful SQL feature when working with backups, reporting, or filtering data from large datasets.
🔍 What You'll Learn:
How to create source and target tables
How to insert selected rows into another table
Real-world example using employees and sales departments
Tips for filtering and customizing inserted data
💡 SQL Example Covered:
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(100),
department VARCHAR(50),
salary DECIMAL(10,2)
);
INSERT INTO employees (id, name, department, salary) VALUES
(1, 'Alice', 'Sales', 60000.00),
(2, 'Bob', 'IT', 70000.00),
(3, 'Charlie', 'Sales', 65000.00),
(4, 'Diana', 'HR', 55000.00);
CREATE TABLE sales_employees (
id INT PRIMARY KEY,
name VARCHAR(100),
salary DECIMAL(10,2)
);
INSERT INTO sales_employees (id, name, salary)
SELECT id, name, salary
FROM employees
WHERE department = 'Sales';
✅ Perfect for beginners and intermediate SQL users looking to sharpen their MySQL skills.
👍 Like the video if you found it helpful
📝 Comment if you have questions
🔔 Subscribe for more SQL & database tutorials
#MySQL #SQLTutorial #InsertIntoSelect #MySQLForBeginners #DatabaseTutorial #SQLTips #LearnSQL #WebDevelopment #DataEngineering