INSERT INTO SELECT statement:
INSERT INTO SELECT statement is used to copy data from existing table into another table.
Syntax-1:
INSERT INTO tablename2 SELECT * FROM tablename1;
Syntax-2
INSERT INTO tablename2 (columnname(s)) SELECT columnname(s) FROM tablename1;
Example:
INSERT INTO Employee (Name, City) SELECT StudentName, City FROM School;
This query will insert studentname and his respective city into Employee table from School table.
0 Comment(s)