How to use insert into statement

The creation of a new record in a table is done with the insert statement. Basically there are two ways to insert new records. The first one is by using the values subclause to specify the values for the columns of the new record like in:

insert into employee(emp_id, last_name, first_name, starting_date, salary)
values  (101,    ‘Smith’  , ‘John’,     ‘6/1/2021’,    78000.00);

The other way to create new records in a table is by inserting a set of records, which are the result of a select SQL statement, like in:

insert into employee(last_name, first_name, starting_date)
        select last_name, first_name, ‘08/01/2021’ from candidates
            where status = ‘to be hired’;

The previous insert can create many new records, however those new records will not have a defined value in the column emp_id and salary because these two columns are not included in the query.

IN THIS PAGE