Insert Data Using SELECT in MySQL
📖 Scenario: You work in a company database where customer orders are stored in one table, and you want to create a summary table that stores only orders with a total amount greater than 100. This helps the sales team focus on big orders.
🎯 Goal: Create a new table called big_orders and insert data into it by selecting orders from the orders table where the total amount is greater than 100.
📋 What You'll Learn
Create a table called
big_orders with columns order_id, customer_name, and total_amount.Insert data into
big_orders by selecting from orders where total_amount is greater than 100.Use the
INSERT INTO ... SELECT ... syntax.💡 Why This Matters
🌍 Real World
In real companies, copying filtered data from one table to another helps create reports or summaries for specific needs, like focusing on big orders.
💼 Career
Database administrators and developers often use INSERT with SELECT to move or archive data efficiently without manual re-entry.
Progress0 / 4 steps