The INSERT statement inserts rows into a table or view. Inserting a row into a view also inserts the row into the table on which the view is based. You can insert one row at a time, using values provided or referenced from other tables. The values that you are inserting must conform to any constraints that may exist on the table or view. You do not have to insert values for all of the columns in the table when you insert a row. The rest of the columns are assigned the default value specifed for the column or for the data type of the column. However, the columns listed in the INSERT statement and the number of values must be the same. The VALUES list can contain expressions, literals, NULL, or DEFAULT. See Expressions for more information.
You can use SQL Assist to build your INSERT statement. See SQL Assist for more information.
Insert a new department with the following specifications into the DEPARTMENT table:
Department number (DEPTNO) is 'E31'
Department name (DEPTNAME) is 'ARCHITECTURE'
Managed by (MGRNO) a person with number '00390'
Reports to (ADMRDEPT) department 'E01'
INSERT INTO DEPARTMENT VALUES ('E31', 'ARCHITECTURE', '00390', 'E01')Create a temporary table MA_EMPPROJACT with the same columns as the EMPPROJACT table. Load MA_EMPPROJACT with the rows from the EMPPROJACT table with a project number (PROJNO) starting with the letters 'MA'.
CREATE GLOBAL TEMPORARY TABLE MA_EMPPROJACT LIKE EMPPROJACT WITH NO DATA
INSERT INTO MA_EMPPROJACT SELECT * FROM EMPPROJACT WHERE SUBSTR(PROJNO, 1, 2) = 'MA'
For more information, see INSERT in the SQL Reference topic in the
Information Center.