You add rows to the database using the INSERT statement. The INSERT statement has two forms: you can use the VALUES keyword or a SELECT statement:
The VALUES keyword specifies values for some or all the columns in a new row. A simplified version of the syntax for the INSERT statement using the VALUES keyword is:
INSERT [ INTO ] table-name [ ( column-name, ... ) ] VALUES ( expression, ... )
You can omit the list of column names if you provide a value for each column in the table, in the order in which they appear when you execute a query using SELECT *.
You can use SELECT within an INSERT statement to pull values from one or more tables. If the table you are inserting data into has a large number of columns, you can also use WITH AUTO NAME to simplify the syntax. Using WITH AUTO NAME, you only need to specify the column names in the SELECT statement, rather than in both the INSERT and the SELECT statements. The names in the SELECT statement must be column references or aliased expressions.
A simplified version of the syntax for the INSERT statement using a select statement is:
INSERT [ INTO ] table-name [ WITH AUTO NAME ] select-statement
For more information about the INSERT statement, see INSERT statement.
Inserting values into all columns of a row
Inserting values into specific columns
Adding new rows with SELECT
Inserting documents and images
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |