Syntax :
INSERT INTO table_name (field1, field2, filed3,...)
VALUES ('value1', 'value2', 'value3',...);
INSERT statement is used to insert data into a database table. When using the INSERT statement, you specify the table name and the values that need to be inserted.
Insert data into certain columns you will need to specify only these columns as part of the statement.
Example 1 :
The below query is to insert the data in 'employee' table.
INSERT INTO employee(first_name, last_name, date_of_join, salary, location)
VALUES ('Rama', 'Krishna', '2011-08-01', '15000', 'Chennai');
Example 2 :
You can also use the INSERT query without specifying the column names. In this case, you need to provide a value for each column in the order that they are listed in the table
INSERT INTO employee
VALUES ('1','Srinivas', 'A', '2011-09-25', '16000', 'Chennai','1')
Example 3 :
The below query is to insert multiple rows in 'employee' table using single query.
INSERT INTO employee(first_name, last_name, date_of_join, salary, location)
VALUES ('Suresh', 'K', '2011-08-01', '15000', 'Chennai'),('Karthik', 'M', '2012-06-01', '14000', 'Hyderabad');