It is used to add new rows(tuples) of data to a table in the database.
There are two basic syntaxes of INSERT INTO statement as follows:
Syntax 1:
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)
VALUES (value1, value2, value3,...valueN);
Here, column1, column2,...columnN are the names of the columns in the table into which you want to insert data and value1,value2... valueN are the values of particular column.
Please be sure that you enter appropiate value for particular column i.e. for column1 enter value of column1(value1).If you don't do so,it's may lead to error because for example column1 having NUMBER datatype and for coloumn2,it is VARCHAR2.Assume in above syntax for coloumn1 you enter value of second column means varchar2 type value which leads to mismatch of datatype.
Example 1:
ASSUME : we have empty table named STUDENT.
Table : STUDENT
We run below queries now,
INSERT INTO STUDENT (SID,NAME,AGE)
VALUES (01, 'KULDEEP', 20);
INSERT INTO STUDENT (SID,NAME,AGE)
VALUES (02, 'PAL', 04);
Result of above query :
Table : STUDENT
You may not need to specify the column(s) name in the SQL query if you are adding values for all the columns of the table. But make sure the order of the values is in the same order as the columns in the table. The SQL INSERT INTO syntax would be as follows:
Syntax 2:
INSERT INTO TABLE_NAME VALUES (value1,value2,value3,...valueN);
Example 2:
INSERT INTO STUDENT
VALUES (03, 'ARPIT',15);
At last we run above query which gives below result,