Interview Question

What is sequence?

A sequence generates numeric values and may contain gaps.

💡 Concept ✅ Quick Revision 🗃️ SQL

Answer

A sequence is a database object that generates a sequence of numeric values. • It is commonly used to supply surrogate identifiers. • Calling a sequence advances it independently of ordinary table row visibility. • Gaps can occur and sequence values should not be treated as gapless business numbering.

💡 SQL Example

CREATE SEQUENCE order_number_seq START WITH 1000; SELECT nextval('order_number_seq');

Result

1000

⚡ Quick Revision

A sequence generates numeric values and may contain gaps.