Databases Reference
In-Depth Information
as either a SET table, a MULTISET table, or a LIST table. By default, a table
is a MULTISET table. SET tables and LIST tables share all the properties
of MULTISET tables, but have the additional properties that a SET table
can contain no duplicate rows, and a LIST table has an order defined for
the rows. Each table has a data type, which consists of the specification of
whether the table is a MULTISET, SET, or LIST table, and the row type
of the table. The row type of a table is the sequence of (column name, data
type) pairs specified in the table definition. These data types can include
ADTs as well as built-in types. The only way that an ADT instance can be
stored persistently in the DB is as the column value of a table.
Tables have also been enhanced in SQL: 1999 with a subtable facility.
The purpose of this functionality is to provide a degree of inheritance to
what has been a relational concept, namely, the table. A table can be declared
as a subtable of one or more supertables (it is then a direct subtable of those
supertables), using an UNDER clause associated with the table definition.
When a subtable is defined, the subtable inherits every column from its
supertables and may also define columns of its own. The concept of subtable
is completely independent from that of the ADT. Any base table that has a
subtable or a supertable has a row identifier implicitly defined. The row iden-
tifier type for a table with supertables is a subtype of the row identifier type
defined for each supertable. An example follows.
CREATE TABLE person
(name CHAR(20),
sex CHAR(1),
age INTEGER,
spouse person IDENTITY);
CREATE TABLE employee UNDER person
(salary FLOAT);
CREATE TABLE customer UNDER person
(account INTEGER);
By including the row identifier as an argument, routines can be associated
with tables to implement object-like operations on rows, and more special-
ized routines can be associated with subtables to support polymorphism for
those operations.
Search WWH ::




Custom Search