INSERT statement
Derby Reference Manual
60
To grant the SELECT privilege on table
s.v
to all users, use the following syntax:
GRANT SELECT ON TABLE s.v to PUBLIC
To grant the EXECUTE privilege on procedure
p
to the authorization ID
george
, use the
following syntax:
GRANT EXECUTE ON PROCEDURE p TO george
To grant the role
purchases_reader_role
to the authorization IDs
george
and
maria
, use the following syntax:
GRANT purchases_reader_role TO george,maria
To grant the SELECT privilege on table
t
to the role
purchases_reader_role
, use
the following syntax:
GRANT SELECT ON TABLE t TO purchases_reader_role
To grant the USAGE privilege on the sequence generator
order_id
to the role
sales_role
, use the following syntax:
GRANT USAGE ON SEQUENCE order_id TO sales_role;
To grant the USAGE privilege on the user-defined type
price
to the role
finance_role
, use the following syntax:
GRANT USAGE ON TYPE price TO finance_role;
INSERT statement
An INSERT statement creates a row or rows and stores them in the named table. The
number of values assigned in an INSERT statement must be the same as the number of
specified or implied columns.
Whenever you insert into a table which has generated columns, Derby calculates the
values of those columns.
Syntax
INSERT INTO table-Name
[ (
Query [
]
[
[
Query can be:
· A single-row or multiple-row VALUES expression
Single-row and multiple-row VALUES expressions can include the keyword
DEFAULT. Specifying DEFAULT for a column inserts the column's default value
into the column. Another way to insert the default value into the column is to omit
the column from the column list and only insert values into other columns in the
table. For more information, see
The DEFAULT literal is the only value which you can directly insert into a generated
column.
· UNION expressions
When you want insertion to happen with a specific ordering (for example, in conjunction
with auto-generated keys), it can be useful to specify an ORDER BY clause on the result
set to be inserted.