WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

SQL INSERT INTO


The INSERT INTO articulation is utilized to add new lines of information to a table in the database.


The SQL INSERT INTO Statement

The INSERT INTO proclamation is utilized to add new lines of information to a table in the database.

SQL INSERT INTO Syntax

It is conceivable to compose the INSERT INTO proclamation in two structures.

The SQL INSERT INTO punctuation is as follows:

Addition INTO table_name1
Qualities (value1,value2,value3,...);

The second SQL INSERT INTO punctuation is as follows:

Supplement INTO table_name2 (column1,column2,column3,...)
Qualities (value1,value2,value3,...);

Database

In this instructional exercise we will utilize the example database.

Below is a determination from the "Customers" table:

CustomerID FirstName City Country
1 Jhon Dallas United States
2 Eva Houston United States
3 Maria Texas USA
4

Rajesh Delhi India
5

Stephine Lule UK

INSERT INTO Example

Assume we wish to embed another line in the "Customers" table.

We can utilize the accompanying SQL statement:

Example

Addition INTO Customers (CustomerID,FirstName,City,Country )
Qualities ('1','Tony','Delhi','India');


The selection from the "Customers" table will now look like this:

CustomerID FirstName Place Phonenumber City
1 Robert L. Gardner Briarhill Lane Youngstown 704-376-9376 OH
2 Anna W. Simpson Kooter Lane Charlotte +108737-363 NC
3 Sally E. Davison Burnside Court Phoenix +1602-447-7098 AZ
3

Bethany G. Gibbs Brooke Street Houston +1713-621-1441 TX
4

Charles A. Arias Carter Street St Libory +1618-768-6686 IL
5 Billy D. Perry Middleville Road Santa Fe Springs +626-399-3811 CA

Insert Data in Specified Columns

It is used to insert the data into the corresponding columns:.

The following SQL statement will insert a new row, but only insert data in the "CustomerName", "Company", and "Favorite color" columns :

Example

INSERT INTO Customers (CustomerName, Company, )
VALUES ('Raymond M. Keating', 'Netobill', 'Orange');

The selection from the "Customers" table will now look like this:

CustomerID FirstName Birthday Company Occupation Favorite color
1 September 8, 1942 Netobill Counter and rental clerk Orange
2 Gary C. Grace September 27, 1962 Honest Air Group Trial lawyer Blue
3 Heather N. McAnults January 9, 1960 Zephyr Investments Climatologist Blue
4

Armand E. Reese August 8, 1997 Nutri G Abdominal sonographer Blue
5

Kristina H. Riveria August 1, 1938 Kent's Allopathic surgeon Green