INSERT INTO | Table Name (column name,column name...) |
VALUES | (value,value...) |
When using the INSERT statement, the Table Name is listed after INSERT INTO and the column names are separated by commas in the parentheses after the INSERT INTO. The values to be added to the record are listed in parentheses after VALUES, with the values separated by commas. If the value is a string, it must be enclosed in quotation marks.
INSERT INTO | EMP (EMPNO,NAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) |
VALUES | (9999,'SAN','SALESMAN',7698,1981-09-28,1000,500,10) |
When adding values to all items in a Table, column names can be omitted and are written as follows.
INSERT INTO | EMP |
VALUES | (9999,'SAN','SALESMAN',7698,2004-06-24,1000,500,10) |
To set values for some items, enter the name of the item to store the value to be added after the Table Name as shown below, and enter the value to be added in VALUES.
INSERT INTO | EMP (EMPNO,ENAME) |
VALUES | (9999,'SAN') |
INSERT INTO | EMP_TEMP |
SELECT | * |
FROM | EMP |
WHERE | JOB = 'SALESMAN' |
By changing the VALUES keyword into a SELECT statement, it is possible to add selected records from another Table to the Table.
This completes the [ ADD RECORD INSERT statement ].