bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL INSERT INTO Statement

Concept visual

SQL INSERT INTO Statement

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

The SQL INSERT INTO Statement

The INSERT INTO

statement is used to insert new records in a table. It is possible to write the INSERT INTO statement in two ways:

Syntax 1

Specify both the column names and the values to be inserted:

Insert Into

table_name ( column1, column2, column3, ...) VALUES (

value1, value2, value3, ...);

Syntax 2

If you insert values for ALL the columns of the table, you can omit the column names. However, the order of the values must be in the same order as the columns in the table:

Insert Into

table_name VALUES (

value1, value2, value3, ...);

Demo Database

Below is a selection from the

Customers table used in the examples:

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

89

White Clover Markets

Karl Jablonski

Formula

305 - 14th Ave. S. Suite 3B

Seattle

98128

Usa

90

Wilman Kala

Matti Karttunen

Keskuskatu 45

Helsinki

21240

Finland

91

Previous

SQL NOT Operator

Next

SQL NULL Values