Adds rows to a specified table.
Category: | Data Manipulation |
Supports: | EXECUTE Statement |
Data source: | SAS data set, SPD Engine data set, SASHDAT file, Aster, DB2 under UNIX and PC, Greenplum, HDMD, Hive, MDS, MySQL, Netezza, ODBC, Oracle, PostgreSQL, SAP HANA, Sybase IQ, Teradata |
specifies the name of a table into which you are inserting rows.
Restriction | If row-level permissions are in effect for the table, you cannot insert rows into the table. Row-level security is available only with SAS Federation Server. For more information about row-level security, see the SAS Federation Server documentation. |
specifies a data value to insert into the table.
Restriction | There must be one value for each column in the table or for each column in the column list (column). |
Requirement | If columns are specified in the column list (column), the data values list should be in the same order as the column list. |
Tip | You can use parameter arrays in the INSERT statement. |
specifies the column into which you are inserting data.
Tip | You can specify more than one column. The columns do not have to be in the same order as they appear in the table as long as the order of the column list and the data values list match one another. |
specifies any valid query expression that returns rows and where the number of columns in each row is the same as the number of items to be inserted.
See | SELECT Statement |
insert into customers values (1,'Peter Frank', '300 Rock Lane', 'Boulder', 'CO', 'United States', '3039564321', date '2012-01-14'); insert into customers values (2,'Jim Stewart', '1500 Lapis Lane', 'Little Rock', 'AR', 'United States', '8705553978', date '2012-03-20'); insert into customers values (3,'Janet Chien', '75 Jujitsu', 'Nagasaki', '', 'Japan', '01181956879932', date '2012-06-07'); insert into customers values (4,'Qing Ziao', '10111 Karaje', 'Tokyo', '', 'Japan', '0118136774351', date '2012-10-12'); insert into customers values (5,'Humberto Sertu', '876 Avenida Blanca', 'Buenos Aires', '', 'Argentina','01154118435029', date '2012-12-15');
insert into sales values (3234, 1, 189400, 'United States'); insert into sales values (1424, 3, 555789, 'Japan'); insert into sales values (3421, 4, 781183, 'Japan'); insert into sales values (3421, 2, 2789654, 'United States'); insert into sales values (3975, 5, 899453, 'Argentina');
insert into products (prodid, product) values (1424, 'Rice'); insert into products (prodid, product) values (3421, 'Corn'); insert into products (prodid, product) values (3234, 'Wheat'); insert into products (prodid, product) values (3485, 'Oat');
insert into salesum ( sum_sales, max_sale, min_sale, avg_sale) values ( (select sum(totals) from sales), (select max(totals) from sales), (select min(totals) from sales), (select avg(totals) from sales) );