SQL INSERT INTO Query | INSERT Command in SQL | Insert Statement in SQL


The SQL INSERT statement is used to insert a one or more records in a table. There are two syntax’s for the INSERT statement depending on whether you are inserting one record or multiple records.

SQL Insert Statement | Tech-Mirror
SQL Insert Statement | Tech-Mirror


It will work, when we inserting a single record in SQL.

While inserting a row, if you are adding value for all the columns of the table you need not specify the column(s) name in the query. But you need to make sure the order of the values is in the same order as the columns in the table.

For Example: If we want to insert a row to the employee_master table, the query would be like,

Note : When adding a row, only the strings, characters or date values should be enclosed with single quotes.Integer or decimal values will remain as it is.

If you are inserting data to all columns, the column names can be omitted. The above insert statement can also be written as,

Inserting data to a table through a select statement.

Syntax for SQL INSERT is:

For Example: To insert a row into the employee_master table from a temporary table, the sql insert query would be like,

If we want to insert data to all the columns, the above insert statement can also be written as,

Note : We have assumed the temp_employee table has all columns in the above query for given order and the same datatype.

Check this Database Design

Leave a Reply

Your email address will not be published. Required fields are marked *