Book Contents

Book Index

Next Topic

Home

INSERT

The INSERT command inserts values into the Write Optimized Store (WOS) for all projections of a table.

Syntax

INSERT [ /*+ direct */ ] INTO table [ ( column [, ...] ) ]

{ DEFAULT VALUES |

VALUES ( { expression | DEFAULT } [, ...] ) | SELECT...

}

Semantics

/*+ direct */

writes the data directly to disk (ROS) instead of memory (WOS). This syntax is only valid when used with INSERT...SELECT.

table

specifies the name of a table in the schema. You cannot INSERT tuples into a projection.

column

specifies a column of the table.

DEFAULT VALUES

fills all columns with their default values as specified in CREATE TABLE.

VALUES

specifies a list of values to store in the correspond columns. If no value is supplied for a column, Vertica implicitly adds a DEFAULT value, if present. Otherwise Vertica inserts a NULL value or, if the column is defined as NOT NULL, returns an error.

expression

specifies a value to store in the corresponding column.

DEFAULT

stores the default value in the corresponding column.

SELECT...

specifies a query (SELECT statement) that supplies the rows to be inserted.

Notes

Examples

INSERT INTO FACT VALUES (101, 102, 103, 104);

INSERT INTO CUSTOMER VALUES (10, 'male', 'DPR', 'MA', 35);

INSERT INTO T1 (C0, C1) VALUES (1, 1001);

INSERT INTO films

SELECT * FROM tmp_films

WHERE date_prod < '2004-05-07';

SQL Language References

PostgreSQL 8.0.12 Documentation

BNF Grammar for SQL-99