SQL INSERT with examples – SIMPLIFIED

sql-insert-examples
Spread the love

Data insertion in SQL database is done using the INSERT INTO statements.

Syntax:

INSERT INTO TAB_NAME(COL_1, COL_2, COL_3)
VALUES (value_1, value_2, value_3) ;

In the insert statement you need to specify the the name of the table, column names, and values you want to insert.

Note:
You need to follow the order when you specify the column names and values.
If you are inserting values into all the columns of the table, you can just skip the column names.

EXAMPLE:

We will use the following demo table named EVENTS.

INSERT INTO EVENTS
VALUES (13, '200M', 2016, 'Edward', 'Snowden', 'Vlad');

Multiple rows insertion

 You can also install multiple rows too using  similar syntax:

INSERT INTO tab_name
Values (val_1, val_2, val_3),
(val_4, val_5, val_6),
(val_7, val_8, val_9) ;

Check the row 14, 15 and 16.

Thanks For Reading!

Sources: Microsoft documentation – READ

Learn more– SQL basic