5.2 Tabular Variables in SQL
When we introduced tables in Chapter 3, we assumed that the contents of a table
is a relation, that is, it is a set of tuples. To conform to the reality of databases
we need to define the content of a table as a sequence of tuples. Thus, a table
may contain several copies of the same tuple. If a table is allowed to contain
duplicates, then even if we know all components of a tuple, we may be unable
to identify the corresponding row in the table uniquely. As a consequence, not
every table has a key.
In this section we present a topic that we refer to informally as “table cre-
ation”. In reality, we create an object similar to a variable in a programming
language that we call a tabular variable. The values of a tabular variables are
tables and these values change in time. Tabular variables are created using the
construction create table.