InterviewSolution
Saved Bookmarks
| 1. |
Define sequence. |
|
Answer» A sequence is a schema-bound, user-defined object which aids to generate a sequence of integers. This is most commonly used to generate values to IDENTITY columns in a table. We can create a sequence by USING the CREATE SEQUENCE statement as shown below: CREATE SEQUENCE serial_num START 100;To get the NEXT number 101 from the sequence, we use the nextval() method as shown below: SELECT nextval('serial_num');We can also use this sequence while inserting new records using the INSERT command: INSERT INTO ib_table_name VALUES (nextval('serial_num'), 'interviewbit'); |
|