INSERT INTO Keyword
The Insert Into keyword is used to add a new row to a table.
Syntax
INSERT INTO <TABLE_NAME>(<COLUMN_NAMES>) VALUES (<DATA_VALUES>);
Example 1
If we don't want to add all the column data, then we need to define column names.
INSERT INTO Employee(Id,Emp_Name,Age) VALUES(1,'Uday',26);
Example 2
If we add all the column data, there is no need to define column names.
INSERT INTO Employee VALUES(1,'Uday',26);
INSERT INTO SELECT Keyword
The Insert Into Select keyword is used to insert data into a table from another table.
When we used the Insert Into Select command, we defined the same number of columns in the same order and also the same data type.
Syntax
INSERT INTO <TABLE_NAME2> (<COLUMN_NAMES>) SELECT <COLUMN_NAMES> FROM <TABLE_NAME1>;
Example 1
INSERT INTO Employee_New (Id,Emp_Name,Age) SELECT Id,Emp_Name,Age FROM Employee;
Example 2
INSERT INTO Employee_New SELECT * FROM Employee;
Summary
The Insert Into keyword is used to add a new row to a table.