CP363 : SQL INSERT

Function

To insert a single row (format 1) or a selection of rows from elsewhere in the database (format 2) into a table.

Syntax

INSERT INTO [ owner.]table-name [( column-name, ... )]
... VALUES ( expression, ... )

Description

The INSERT statement adds new tuples to a database table.

Examples


INSERT INTO member
( last_name, first_name, address, email )
VALUES
( 'Brown', 'David', 'No Fixed address', 'dbrown@wlu.ca' )

Inserts the given values into member. member_id is not given since it has a default (IDENTITY) value.


INSERT INTO pub
( member_id, p_title, journal, publisher, price )
VALUES
( 5, 'Murphy''s World', NULL, 'Peregrine', 17.95 )