The DBMS provides built-in methods for the types supported through type constructors. These methods are analogous to built-in operations such as addition and multiplication for atomic types such as integers.
Built-in Operators for Structured Types
Rows: Given an item i whose type is ROW(n 1 t 1 ,...,n n t n ), the field extraction method allows us to access an individual field n k using the traditional dot notation i:n k .Ifrow constructors are nested in a type definition, dots may be nested to access the fields of the nested row; for example i.n k .m l . If we have a collection of rows, the dot notation gives us a collection as a result. For example, if i is a list of rows, i.n k gives us a list of items of type t n ;if i is a set of rows, i.n k gives us a set of items of type t n .
This nested-dot notation is often called a path expression because it describes a path through the nested structure.
Sets and multisets Set objects can be compared using the traditional set methods An item of type setof(foo) can be compared with an item of type foo using the method. Two set objects (having elements of the same type) can be combined to
and ? operators.
form a new object using the
Each of the methods for sets can be defined for multisets, taking the number of copies of elements into account. The operation simply adds up the number of copies of an element, the operation counts the lesser number of times a given element appears in the two input multisets, and ? subtracts the number of times a given element appears in the second multiset from the number of times it appears in the first multiset.
For example, using multiset semantics
Lists: Traditional list operations include head, which returns the first element; tail, which returns the list obtained by removing the first element; prepend,which takes an element and inserts it as the first element in a list; and append, which appends one list to another.
Arrays: Array types support an `array index' method to allow users to access array items at a particular offset. A postfix `square bracket' syntax is usually used; for example, foo array[5].
The aggregate operators count, sum, avg, max,and min, which can be applied to any object of a collection type. Operators for type conversions are also common.