SQL DB GENERATED SEQUENCE
SQL SEQUENCE OBJECT SEQUENCE OBJECT are similar to IDENTITY COLUMN in the way that they both generate unique values and use almost same attributes. However, sequences are objects are independent of any tables. Sequences are not tied to a column in a table and are accessed separately. Additionally, they are not treated as any part of a [...]
Using ROWID is another way to have the system assign a unique value to a column. ROWID is similar to IDENTITY COLUMNS. But rather than being an attribute of a numeric column, it is a separate data type. Same as IDENTITY COLUMNS there are 2 options for GENERATED clause. ALWAYS BY DEFAULT
IDENTITY COLUMN An IDENTITY COLUMN is a numeric column defined in a table for which the column values can be generated automatically by DB2. Only columns of type SMALLINT, INTEGER, BIGINT, DECIMAL, or NUMERIC are allowed for identity columns. Maximum one identity column per table is allowed IDENTITY COLUMN is implicitly NOT NULL.
Let say you add a column ID in your table and you want an incremented value for this column every time a new record is inserted in Table or later you want to re-sequence the same ID column starting from 1. There can be multiple tricks to achieve this but SQL provides multiple very simple and handy option to do all these tasks where a [...]