Chapter 24. Creating Sequences

Introduction

Many tables that are created have a column with unique numbers. These numbers identify the rows. Usually, they also form the primary keys of the tables. We have given several examples in this book of those primary keys. All tables of the sample database contain a column with unique numbers. For example, the player numbers in the PLAYERS table and the team numbers in the TEAMS table are unique. The numbers of the database objects in the catalog tables of the SQL products are often unique as well.

Generating numbers is rather difficult, which is why SQL supports a database object with which it can generate a series of numbers in a simple way. This database object is called the sequence. With sequences, we ...

Get Introduction to SQL: Mastering the Relational Database Language, Fourth Edition/20th Anniversary Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.