SQL, SQL Server, Tutorials, Oracle, PL/SQL, Interview Questions & Answers, Joins, Multiple Choice Questions, Quiz, Stored Procedures, Select, Insert, Update, Delete and other latest topics on SQL, SQL Server and Oracle.
INSERT INTO SELECT
INSERT INTO SELECT
In order to insert data from one table to another table we use the below query:
INSERT INTO DummyTable (First_Name, Last_Name)
SELECT First_Name, Last_Name
FROM EmployeeName
WHERE Salary = 20000
If columns listed in insert clause and select clause are same, we do not need to list them.
With "INSERT INTO SELECT" you can insert many rows at a time. This can be used if we want to insert values into our table by selecting these from:
1. Another table in our database
2. A totally different database on the same server
3. From the same table etc.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment