Thursday, May 9, 2013

INSERT Statement

INSERT Statement


The SQL INSERT statement allows you to insert a single record or multiple records into a table.

Syntax:




INSERT INTO table

(column-1, column-2, ... column-n)

VALUES

(value-1, value-2, ... value-n);



INSERT Statement - Using VALUES keyword example

Sample:

insert into customer (customer_id,customer_name)
values (101,'CustName');



SQL INSERT Statement - Using sub-selects

Sample:

insert into customer (customer_id,customer_name)
select cust_id,first_name from customer_temp;

0 comments:

Post a Comment