INSERT INTO
statement adds new rows to an existing table using a SELECT
statement or explicitly stating input values.
INSERT INTO
is as follows:
table_name
: The table name.(columns_order)
: Optional column order in the table.select_statement
: A SELECT
statement that provides the data to insert. For example, SELECT (value 1), (value 2), ... (value n);
.weight
table with columns kilo
and gram
. Then, we add data using the default column order (kilo
, gram
).
gram
, kilo
).
gram
column while leaving the kilo
column as NULL.
kilo
) as NULL.
weight
has only 2 columns.
gram
column and a NULL value into a kilo
column.
gram
column, leaving the kilo
column empty, where there is a NOT NULL constraint.