Inserting Data (Embedded SQL Guide)
From InterBase
Go Up to Working with Data
New rows of data are added to one table at a time with the INSERT
statement. To insert data, a user or stored procedure must have INSERT
privilege for a table.
The INSERT
statement enables data insertion from two different sources:
- A
VALUES
clause that contains a list of values to add, either through hard-coded values, or host-language variables. - A
SELECT
statement that retrieves values from one table to add to another.
The syntax of INSERT
is as follows:
INSERT [TRANSACTION name] INTO table [(col [, col ...])] {VALUES (<val>[:ind] [, <val>[:ind] ...]) | SELECT <clause>};
The list of columns into which to insert values is optional in DSQL applications. If it is omitted, then values are inserted into a table’s columns according to the order in which the columns were created. If there are more columns than values, the remaining columns are filled with zeros.
Topics
- Using VALUES to Insert Columns
- Using SELECT to Insert Columns
- Inserting Rows with NULL Column Values
- Inserting Data Through a View
- Specifying Transaction Names in an INSERT