SQL INSERT

SQL INSERT

The SQL INSERT statement allows you to insert a single record or multiple records into a table. This SQL statement can be used on any database either it is MySQL or MsSQL.

The syntax for the SQL INSERT statement is:

Below SQL statement can be used if you want to insert data into specific or specified column names then we can use this below statement.
[sql] INSERT INTO table (column-1, column-2, … column-n)
VALUES (value-1, value-2, … value-n);
[/sql]

Inserting Multiple Rows in Single SQL Statement,

[sql] INSERT INTO table (column-1, column-2, … column-n)
VALUES (value-1, value-2, … value-n),
(value-1, value-2, … value-n),
(value-1, value-2, … value-n);
[/sql]

Insert data into table without specifying any column names, below is the statement.
[sql] INSERT INTO table
VALUES (value-1, value-2, … value-n);
[/sql]

Inserting Multiple Rows in Single SQL Statement,

[sql] INSERT INTO table
VALUES (value-1, value-2, … value-n),
(value-1, value-2, … value-n),
(value-1, value-2, … value-n);
[/sql]
Vivek Vengala
 

Vivek Vengala is a Online Entrepreneur, Web Developer from Hyderabad India.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: