Inserting a new row into a single column table in apache derby with generated id
I have the following table:
create table indices (
id int primary key generated by default as identity
);
how do I insert a new row?
I have already tried several things I have found, like:
insert into indices values (null);
inser开发者_StackOverflow中文版t into indices default values;
however that didn't work with derby.
Try "insert into indices values (default)"
You need a column
to insert
into. You have id
which is an identity
, which means it will already have a value when a new row is inserted. Add a new column
and then fill that column
in your insert
statement.
精彩评论