SQL Insert Statement

Here we will learn about Insert statement in SQL(Structure Query Language).

Introduction

As the name suggest INSERT statement is used to add one or more row in database.

Syntax

General syntax for INSERT statement would be

INSERT INTO <table_name>(<column_name>, <column_name>,<column_name>…) VALUES (<values>, <values>, <values>…) WHERE <condition>

TABLE_NAME
Name of the table in which row needs to be inserted.
COLUMN_NAME
List of column name in table/view against which values to insert.
VALUES
Values for corresponding column name

 Note*: Order of column_name and values should be same.

Example

Employee Table :

Inserting a row in employee table for only 3 column.

Insert into employe(name, surName, address) values('Java','Beginners', 'India')

 

Multiple row Insertion

What if we want to insert multiple row of data in a single SQL command in Oracle. In that case we can use “INSERT ALL” statement can be used. Insert all statement help us to insert multiple record in a single query.

Syntax for INSERT ALL

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.